Professional Documents
Culture Documents
Relational Database
The Relational Model
Properties Cont’d
– The sequence of columns (left to right) is insignificant;
the columns of a relation can be interchanged without
changing the meaning or use of the relation
– The sequence of rows (top to bottom) is insignificant;
rows of a relation may be interchanged or stored in
any sequence
The Relational Model...
The
relational model of data has three major
components:
Accounts Accounts
Receivable Payable
Corporate Database
Accounting
Marketing
Index
Table Table
Employee Product
Table Table
Files
Department Customer
The Relational Objects...
Relation
Row
Row
Relational Objects...
Data is presented to the user as tables:
Row
Row
Structure of a relation (e.g. Employee)
Employee(Name, Designation, Department)
Relational Objects...
Data is presented to the user as tables:
Ordering of tuples
– Tuples in a relation don’t have any particular order.
However in a file they may be physically ordered
based on a criteria, this is not there in relational model
Key constraints
– There is a sub set of attributes of a relational schema with
the property that no two tuples should have the same
combination of values for the attributes.
– If a relation has more than one key, they are called
candidate keys
– One of them is chosen as the primary key
Relational Objects
Keys
Employee Department
E-No E-Name D-No D-No D-Name M-No
179 Silva 7 4 Finance 857
857 Perera 4 7 Sales 179
342 Dias 7 Primary Key
Primary Key Foreign Key
Employee
E-Name Pointer E-No E-Name D-No
De Silva 179 Silva 7
Dias 857 Perera 4
Perera 342 Dias 7
Silva 719 De Silva 5
Index: Employee Name Employee
E-Name Pointer E-No E-Name D-No
Alwis 179 Silva 7
Bandara 857 Perera 4
Costa 342 Dias 7
De Silva 719 De Silva 5
Dias 587 Alwis 4
Opatha 432 Costa 6
Peiris 197 Zoysa 2
Perera 875 Peiris 4
Silva 324 Vaas 7
Vaas 917 Bandara 3
Wickrama 785 Opatha 2
Zoysa 234 Wickrama 1
Relational Database
STORE INVENTORY STORE
Store Name | City Store Name | Part No | Quantity Store 1 | Colombo
Store 2 | Kandy
ORDERS
INVENTORY
Store Name | Part No | Vendor No | Order No | Quantity
Store 1 | P1 | 50
Store 1 | P3 | 20
PART VENDOR Store 2 | P2 | 100
Part No | Description Vendor No | Vendor Name Store 2 | P1 | 30