0% found this document useful (0 votes)
17 views8 pages

Relational Model

The document discusses database concepts including the relational model, relation schemas and instances, attributes, relations being unordered, database schemas, keys, and foreign key constraints.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
17 views8 pages

Relational Model

The document discusses database concepts including the relational model, relation schemas and instances, attributes, relations being unordered, database schemas, keys, and foreign key constraints.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 8

Database Concepts

Relational Model

Database System Concepts - 7th Edition 2.1 ©Silberschatz, Korth and Sudarshan
Example of an Instructor Relation

attributes
(or columns)

tuples
(or rows)

Database System Concepts - 7th Edition 2.2 ©Silberschatz, Korth and Sudarshan
Relation Schema and Instance

▪ A1, A2, …, An are attributes.


▪ R = (A1, A2, …, An ) is a relation schema.
Example:
instructor = (ID, name, dept_name, salary)
▪ A relation instance r defined over schema R is denoted by r (R).
▪ The current values of a relation are specified by a table.
▪ An element t of relation r is called a tuple and is represented by
a row in a table.

Database System Concepts - 7th Edition 2.3 ©Silberschatz, Korth and Sudarshan
Attributes

▪ 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. Indicated that


the value is “unknown”.

▪ The null value causes complications in the definition of many


operations.

Database System Concepts - 7th Edition 2.4 ©Silberschatz, Korth and Sudarshan
Relations are Unordered

▪ Order of tuples is irrelevant (tuples may be stored in an arbitrary order).


▪ Example: instructor relation with unordered tuples

Database System Concepts - 7th Edition 2.5 ©Silberschatz, Korth and Sudarshan
Database Schema

▪ Database schema -- is the logical structure of the database.


▪ Database instance -- is a snapshot of the data in the database
at a given instant in time.
▪ Example:
• schema: instructor (ID, name, dept_name, salary)
• Instance:

Database System Concepts - 7th Edition 2.6 ©Silberschatz, Korth and Sudarshan
Keys
▪ Let K  R
R = (A1, A2, …, An ) is a relation schema.
Example:
instructor = (ID, name, dept_name, salary)

▪ K is a superkey of R if values for K are sufficient to identify a unique


tuple of each possible relation r(R).
• Example: {ID} and {ID,name} are both superkeys of instructor.

▪ Superkey K is a candidate key if K is minimal.


Example: {ID} is a candidate key for Instructor.

Database System Concepts - 7th Edition 2.7 ©Silberschatz, Korth and Sudarshan
Keys (Cont.)
▪ Let 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).
• Example: {ID} and {ID,name} are both superkeys of instructor.

▪ Superkey K is a candidate key if K is minimal.


Example: {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.


• Example:
dept_name in instructor is a foreign key from instructor referencing
Database department.th
System Concepts - 7 Edition 2.8 ©Silberschatz, Korth and Sudarshan

You might also like