Professional Documents
Culture Documents
1
The table is called A column header is
relation. called an attribute.
A row is
called a
tuple.
The data type describing the types of values in each columns is called a
domain. 2
Relational schema
• A domain D is a set of atomic values which means it is
indivisible for this relation.
• For the relational schema R(A1,A2,A3, …., An):
• R is the name of the relation
• A1,A2,A3, …., An are the attributes
• Each attribute Ai is the name of a role played by some
domain D (dom(Ai)) in the relation schema R.
• The degree of a relation is the number of attributes n of its
relation schema.
• Ex: STUDENT(Name,
SSN,HomePhone,Adrress,OfficePhone,Age,GPA)
3
Relational Constraints
• It is called uniqueness
Each attribute constraint that no two Not Null
A must be an distinct tuples in r can constraint
atomic value have the same values specifies that
from the for SK. an attribute
domain • A superkey can have must have a
dom(A). redundant attributes. valid value.
4
Integrity Constraints
Entity integrity
Referential integrity constraints
constraint
6
7
8
Relational model operations
13
Answer 3.17. (con’t)
Sample tuples
• insert into CAR(Serial_no, Model, Manufacturer, Price) values
(‘sd435jb’,’kia’,’japan’,125000);
insert into OPTION(Serial_no, Option_name, Price) values
(‘sd435jb’,’automatic’,10000);
insert into SALESPERSON(Salesperson_id, Name, Phone) values
(1,’jason’,’01234565649’);
insert into SALE(Salesperson_id, Serial_no, Date, Sale_price) values
(1,’sd435jb’, '2007-05-06',130000);
• Violation statements
insert into SALE(Salesperson_id, Serial_no, Date, Sale_price) values
(11,’sd435jb’, '2007-05-06',130000);
14