3.1 Relational Databases: Terminology

3. The Relational Model

Databases: Case Example


Ord_Aug


Ord # OrdDate Cust#
101 02-08-94 002
102 11-08-94 003
103 21-08-94 003
104 28-08-94 002
105 30-08-94 005
Ord_Items
Ord # Item # Qty
101 HW1 100
101 HW3 50
101 SW1 150
102 HW2 10
103 HW3 50
104 HW2 25
104 HW3 100
105 SW1 100
Items
Item # Descr Price
HW1 Power Supply 4000
HW2 101-Keyboard 2000
HW3 Mouse 800
SW1 MS-DOS 6.0 5000
SW2 MS-Word 6.0 8000
Customers
Ord # OrdDate Cust#
101 02-08-94 002
102 11-08-94 003
103 21-08-94 003
104 28-08-94 002
105 30-08-94 005
Term
Meaning
Eg. from the given Case Example
Relation A table Ord_Aug, Customers, Items etc.
Tuple A row or a record in a relation.
A row from Customers relation is a Customer tuple.
Attribute A field or a column in a relation. Ord_Date, Item#, CustName etc.
Cardinality of a relation The number of tuples in a relation. Cardinality of Ord_Items relation is 8
Degree of a relation The number of attributes in a relation. Degree of Customers relation is 3.
Domain of an attribute The set of all values that can be taken by the attribute. Domain of Qty in Ord_Items is the set of all values which can represent quantity of an ordered item.
Primary Key of a relation An attribute or a combination of attributes that uniquely defines each tuple in a relation. Primary Key of Customers relation is Cust#.

Ord# and Item# combination forms the primary Key of Ord_Items
Foreign Key An attribute or a combination of attributes in one relation R1 which indicates the relationship of R1 with another relation R2.

The foreign key attributes in R1 must contain values matching with those of the values in R2
Cust# in Ord_Aug relation is a foreign key creating reference from Ord_Aug to Customers. This is required to indicate the relationship between Orders in Ord_Aug and Customers.

Ord# and Item# in Ord_Items are foreign keys creating references from Ord_Items to Ord_Aug and Items respectively.
3. The Relational Model
Powered by Blogger.