Main Menu
Lecture 1
Lecture 2
Lecture 3
Lecture 5
Lecture 6
Lecture 7
 

 

 

Database Attributes Continued...

Keys

An attribute where every value is unique.

e.g. student number uniquely identifies a particular student thus it can be used to index all the tuples in the table.

Each relation has a key (may require more than one field) thus there are no duplicates in a relation.

Null values are forbidden in the primary key.

Referential Constraint or foreign key

The information in one relation (Marks) is given meaning and completeness through reference to the primary key of another relation (student)

Also to the relation subject through the primary key of the subject relation.

Constraint - the references are significant because values in the relation Marks are equal to values present in the relation Student

Marks relation
Exam paper number Student Subject Grade
1 2001XXXX Database F
5 2001XXXX Networks D
2004 2001XXXX Multimedia HD
195 2001XXXX Networks P
63 2001XXXX Multimedia P

Student relation
Number Name uid
2001XXXX Yu yu01
2001XXXX Wu wu21
2001XXXX John NULL
2001XXXX Smith srt03
2001XXXX Owen ojm01