Professional Documents
Culture Documents
Df117session 2
Df117session 2
Df117session 2
Consists of a collection of tables Unique names for all the tables Each table represents an entity set Entity:-Real world thing Set:- Group of similar entities Entities and their properties are mapped into tables
ASET
Relations
Tables are known as relations Consists of rows and columns
Each row (tuple) represents an entity Each Column (attribute) represents a property
ASET
Example of a Relation
ASET
Attribute Types
The set of allowed values for each attribute is called the domain of the attribute Attribute values are (normally) required to be atomic; that is, indivisible The special value null is a member of every domain
ASET
Relational Database
A database consists of multiple relations These relations may have interrelations Information about an enterprise is broken up into parts student instructor department Bad design: instructor (ID, name, dept_name, salary, building, budget) results in
ASET
Good Design
ASET
Keys
Let K be the set of some attributes of relation R So K R K is a superkey of R if values for K are sufficient to identify a unique tuple of each possible relation r(R)
{ID} and {ID,name} are both superkeys of instructor.
ASET
Superkey K is a candidate key if K is minimal, Any subset of candidate key must not be a superkey
{ID} is a candidate key for Instructor
One of the candidate keys is selected to be the primary key. Foreign key constraint: Value in one relation must appear in another
Referencing relation Referenced relation