Header Ads

Consider the following relation's schema of “Teacher” and “Class” and database relations.


Problem Statement: 




style="display:block; text-align:center;"
data-ad-layout="in-article"
data-ad-format="fluid"
data-ad-client="ca-pub-7200085558568021"
data-ad-slot="3193586076">


Consider the following relation's schema of “Teacher” and “Class” and database relations. 

 

Relations schemas: 

Teacher Schema = (TeacherID:Text, Name:Text, Rank:Text, Department:Text, Salary:Number) 

Class Schema = (ClassID:Text, CourseCode:Text, DayofWeek:Text, Venue:Text, Department:Text) 

 

Database Relations: 

Teacher = { (T001, Dr. Najma Waheed, Professor, CS, 170000),  (T002, Dr. Nouman Masood, Assistant 

Professor, MGT, 120000), (T003, Dr. Farhana Khan, Professor, CS, 150000), (T004, Dr. Tayyaba Ali, Professor, 

CS, 140000), (T005, Mr. Nouman Ahmad, Lecturer, MGT, 80000),  (T006, Mr. Waqass Raheem, Lecturer, ENG, 

75000)} 

Class = { (A001, CS403, Monday, A Block, CS),  (B002, MGT101, Tuesday, B Block, MGT), (C003, ENG201, Monday, C Block, ENG), (B005, CS403, Friday, B Block, CS)} 

 

You are required to perform the following tasks: 

1. Represent the above database relations as a two-dimensional structure called Table. 

2. Perform the following relational algebra operations on the given relations/tables and provide resultant tables. 

        i. σ Department = ‘CS’ (Teacher) ii. Π ClassID, DayofWeek, Venue (Class) 

iii. Π Name, Rank, Department ( σ Rank = ‘Lecturer’ (Teacher) ) 




style="display:block"
data-ad-format="autorelaxed"
data-ad-client="ca-pub-7200085558568021"
data-ad-slot="6426802817">




Solution:




  1. Representing
    the above database relations as a two-dimensional structure called Table:


Teacher
Table:
























































TeacherID



Name



Rank



Department



Salary



T001



Dr.
Najma Waheed



Professor



CS



170000



T002



Dr.
Nouman Masood



Assistant
Professor



MGT



120000



T003



Dr.
Farhana Khan



Professor



CS



150000



T004



Dr.
Tayyaba Ali



Professor



CS



140000



T005



Mr.
Nouman Ahmad



Lecturer



MGT



80000



T006



Mr.
Waqass Raheem



Lecturer



ENG



75000




Class Table:










































ClassID



CourseCode



DayofWeek



Venue



Department



A001



CS403



Monday



A
Block



CS



B002



MGT101



Tuesday



B
Block



MGT



C003



ENG201



Monday



C
Block



ENG



B005



CS403



Friday



B
Block



CS






  1. Perform
    the following relational algebra operations on the given relations/tables
    and provide resultant tables. 

i. σ Department = ‘CS’ (Teacher)




































TeacherID



Name



Rank



Department



Salary



T001



Dr.
Najma Waheed



Professor



CS



170000



T003



Dr.
Farhana Khan



Professor



CS



150000



T004



Dr.
Tayyaba Ali



Professor



CS



140000




ii. Π
ClassID, DayofWeek, Venue (Class)
































ClassID



DayofWeek



Venue



A001



Monday



A
Block



B002



Tuesday



B
Block



C003



Monday



C
Block



B005



Friday



B
Block




iii. Π Name,
Rank, Department ( σ Rank = ‘Lecturer’ (Teacher) )






















Name



Rank



Department



Mr.
Nouman Ahmad



Lecturer



MGT



Mr.
Waqass Raheem



Lecturer



ENG




style="display:block; text-align:center;"
data-ad-layout="in-article"
data-ad-format="fluid"
data-ad-client="ca-pub-7200085558568021"
data-ad-slot="3193586076">

No comments

Powered by Blogger.