Fundamentals of Database Management: Table Properties, Mathematical Relations, and Keys, Slides of Distributed Database Management Systems

An introduction to the basic concepts of database management, focusing on the properties of tables, mathematical relations, and keys. It covers the immaterial order of columns and rows in a table, the concept of cartesian products and relations, and the importance of superkeys, candidate keys, primary keys, and foreign keys in maintaining data integrity.

Typology: Slides

2011/2012

Uploaded on 07/11/2012

zadi
zadi 🇵🇰

4.3

(8)

71 documents

1 / 27

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
Department of Computer Science
Basic Properties of a Table
3. The order of the columns is
immaterial
4. The order of the rows is
immaterial
5. Each row/tuple/record is
distinct, no two rows can be
same
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12
pf13
pf14
pf15
pf16
pf17
pf18
pf19
pf1a
pf1b

Partial preview of the text

Download Fundamentals of Database Management: Table Properties, Mathematical Relations, and Keys and more Slides Distributed Database Management Systems in PDF only on Docsity!

Basic Properties of a Table

3. The order of the columns is

immaterial

4. The order of the rows is

immaterial

5. Each row/tuple/record is

distinct, no two rows can be

same

A table

stID stName clName doB gen der S001 M. Suhail MCS 12/6/84 M

S002 M. Shahid BCS 3/9/86 M

S003 Naila S. MCS 7/8/85 F

S004 Rubab A. MBA 23/4/86 F

S005 Ehsan M. BBA 22/7/88 M

Mathematical Relations

 Consider two sets

 A = {x, y} B = {2, 4, 6}

 Cartesian product of these sets

 A X B= {(x,2), (x,4), (x,6), (y,2), (y,4),

(y,6)}

Mathematical Relations

 A relation is some subset of this

Cartesian product, For example,

 R1= {(x,2), (y,2),(x,6),(x,4)}

 R2 = {(x,4), (y,6), (y,4)}

Database Relations

Thinking in some real world

scenario

 Name = {Ali, Sana, Ahmed, Sara}

 Age = {15,16,17,18,…….,25}

Database Relations

Cartesian product of Name & Age

Name X Age= {(Ali,15), (Sana,15), (Ahmed,15), (Sara,15), …., (Ahmed,25), (Sara,25)}

CLASS = {(Ali, 18), (Sana, 17), (Ali, 20), (Ahmed, 19)}

Relation Scheme

Can be represented as

R = (A1:D1, A2:D2, ……, An:Dn)

STD = (stId:Text, stName: text,

stAdres:Text, doB:Date) OR

STD(stId, stName, stAdres, doB)

Database Relations

According to this scheme we can have

a relation (instance of this scheme),

like

STD={(stId:S001, stName:Ali, stAdres:

Lahore, doB:12/12/76), (stId:S003, stName:A. Rehman, stAdres: RWP, doB:2/12/77)}

DB and Math Relations

 Properties of DB relations are

similar to those of Mathematical

relations, except

 The order of columns in

Mathematical relation does matter

Degree and Cardinality

The number of rows in a

relation is its cardinality and

the number of columns is its

degree

Relational Keys

Primary Key

  • Candidate key selected to identify tuples uniquely within relation.

Alternate Keys

  • Candidate keys that are not selected to be primary key.

Foreign Key

  • Attribute, or set of attributes, within one relation that matches candidate key of some (possibly same) relation.

Relations Keys

 Foreign Key: An attribute of a

table B that is primary key in

another table A

Consider table EMP and DEPT

EMP ( empId , empName, qual, depId)

DEPT ( depId , depName, numEmp)

Significance of Constraints

 Constraints help to maintain the

correctness, validity or integrity

of the database

 Like null constrains, default

value, domain constraint

48

Views

Base Relation

  • Named relation corresponding to an entity in conceptual schema, whose tuples are physically stored in database.

View

  • Dynamic result of one or more relational operations operating on base relations to produce another relation.