Professional Documents
Culture Documents
02 Relational Model PDF
02 Relational Model PDF
Relational Model
Sets and Cross Product
Relational model of the data is based on the mathematical foundation
of sets and was proposed by E. F. Codd.
Consider following sets
name = {Junaid, Sarmad, Kutab, }
2
Relation as a Set
3
Relation Example - Students
Columns as
attributes
5
Attributes and Domains
6
Relation Schema
7
Database
8
Example Database
Student Enrollment
rn name city program rn code when
01 Junaid Multan MSCS 02 101 2014-08-30
02 Sarmad Lahore BSCS 03 101 2014-09-01
03 Kutab Lahore BSCS 04 101 2014-09-01
04 Junaid Peshawar BSSE 04 123 2015-01-30
02 271 2015-09-01
Course 03 272 2015-09-01
code title credits lab 04 271 2015-09-02
101 ICT 3 1 03 302 2016-01-30
123 RE 3 0 04 302 2016-01-30
271 DB 4 1
302 HCI 3 0
9
The Banking Schema
branch = (branch_name, branch_city, assets)
customer = (customer_id, customer_name, customer_street, customer_city)
loan = (loan_number, amount)
account = (account_number, balance)
employee = (employee_id. employee_name, telephone_number, start_date)
dependent_name = (employee_id, dname)
account_branch = (account_number, branch_name)
loan_branch = (loan_number, branch_name)
borrower = (customer_id, loan_number)
depositor = (customer_id, account_number)
cust_banker = (customer_id, employee_id, type)
works_for = (worker_employee_id, manager_employee_id)
payment = (loan_number, payment_number, payment_date, payment_amount)
savings_account = (account_number, interest_rate)
checking_account = (account_number, overdraft_amount)
10
CMS Schema
Program (pid, level, subject, title)
Student (rn, name, city, pid)
Course (ccode, title, credits, lab)
Faculty (fid, name, phone, department, appointment_date)
Staff (sid, name, phone, appointment_date)
Class (cid, ccode, fid, year, semester)
Enrollment (rn, cid, when, status)
Activity (aid, cid, title, description, category, total_marks, start_date, deadline)
Evaluation (rn, aid, marks)
Evaluation (rn, code, marks)
Grade (rn, oid, marks, letter_grade)
11
Case Study
12