Schema Examples
pm_jat @ daiict
XIT Database – Relational Schema
8/5/2019 Relational Model - Concepts 2
XIT Database – Relation Instances
Student
StudentID Name ProgID CPI
101 Rahul BCS 7.5
102 Vikash BIT 8.6
103 Shally BEE 5.4
104 Alka BIT 6.8
105 Ravi BCS 6.5
Program
PID ProgName Intake DID
Department
BCS BTech(CS) 40 CS
DID DName
BIT BTech(IT) 30 CS
CS Computer Engineering
BEE BTech(EE) 40 EE
EE Electrical Engineering
BME BTech(ME) 40 ME
ME Mechanical Engineering
8/5/2019 Relational Model - Concepts 3
Company (Database) Schema
8/5/2019 Relational Model - Concepts 4
Employee
DLocation
Department
8/5/2019 Relational Model - Concepts 5
Department
Projects
8/5/2019 Relational Model - Concepts 6
Works_ON
8/5/2019 Relational Model - Concepts 7
Dependents
8/5/2019 Relational Model - Concepts 8
DA-Acad schema
Student(StudetID, StdName, ProgID, Batch)
Course(CourseNo, CourseName, Credit)
Faculty(FacultyID, FacultyName)
Offers(AcadYear, Semester, CourseNo, FacultyID)
Registers(StudetID, AcadYear, Semester, CourseNo, grade)
Result(StudetID, AcadYear, SemesterType, SPI, CPI)
Semester(AcadYear, SemesterType)
==> Observe Keys here?
==> What are Foreign Keys here?
8/5/2019 Relational Model - Concepts 9
Instructor
DA-ACad
CourseOffering
Course
8/5/2019 Relational Model - Concepts 10
CourseOffering
CourseRegistration
8/5/2019 Relational Model - Concepts 11
DA-Acad schema (FKs)
Offers: CourseNo refers to Course(CourseNo)
Offers: FacultyID refers to Faculty(FacultyID)
Registers: StudetID refers to Student(StudetID)
Registers: (AcadYear, Semester, CourseNo) refers to
Offers(AcadYear, Semester, CourseNo)
Result: StudetID refers to Student(StudetID)
Result(AcadYear, SemesterType)
refers to Semester(AcadYear, SemesterType)
8/5/2019 Relational Model - Concepts 12
Schema HoR #1
STUDENT(id, name, email, prog_code, batch, cpi)
//Batch is like 2009, 2010, or so; Progcode is like ‘01’ for BTech, or so
ROOM(rno, wing, floor)
//floors are like 0 (Ground), 1(First), and 2 (Second)
ALLOT(sid, rno)
//Record of all allotments is stored in this relation. Students (sid) not having
entry in this relation means-they are not residing in the HoR
HMC(sid, wing, Floor)
//Key SID and (Wing, Floor)
8/5/2019 Relational Model - Concepts 13
Schema HoR #2
STUDENT(id, name, email, prog_code, batch, cpi)
//Batch is like 2009, 2010, or so; Progcode is like ‘01’ for BTech, or so
CoursesTaken(stud_id, course_no, sem, acad_yr, grade)
Result(stud_id, sem, acad_yr, SPI, CPI)
ROOM(rno, wing, floor)
//floors are like 0 (Ground), 1(First), and 2 (Second)
ALLOT(sid, rno)
//Record of all allotments is stored in this relation. Students (sid) not
having entry in this relation means-they are not residing in the HoR
SBG(sid, Committee, Role)
//sid is student id of sbg member, and role can be like convener, or
member, committee is name of committee like CMC, or HMC, or so
8/5/2019 Relational Model - Concepts 14
Simplified Company schema
EMPLOYEE (ssn, ename, bdate, dno, gender, superssn)
Foreign Keys: dno REFERENCES department (dno),
Foreign Key: superssn REFERENCES employee (ssn)
DEPARTMENT (dno, dname, mgrssn, mgrstartdate )
Foreign Keys: mgrssn REFERENCES employee (essn)
DEP_LOCATIONS (dno, dlocation)
Foreign Keys: dno REFERENCES department (dno),
PROJECT (pno, pname, plocation, dno)
Foreign Keys: dno REFERENCES department (dno),
WORKS_ON (essn, pno, hours)
Foreign Keys: essn REFERENCES employee (essn)
Foreign Keys: pno REFERENCES project (pno)
DEPENDENT (essn, dep_name, gender, bdate date, relationship)
Foreign Keys: essn REFERENCES employee (essn)
5-Aug-19 Operations on Relations 15
8/5/2019 Relational Model - Concepts 16
8/5/2019 Relational Model - Concepts 17
8/5/2019 Relational Model - Concepts 18