0% found this document useful (0 votes)
55 views

Virtual University of Pakistan: Assignment No. 02 Student Id: Bc210407489

The document describes relations schemas and database relations for a Teacher table and Class table. It asks to represent the relations as tables, and perform relational algebra operations on the tables. The solution represents the relations as two-dimensional tables. It performs the operations of selecting rows from Teacher where Department is 'CS', projecting selected columns from Class, and projecting columns after selecting rows from Teacher where Rank is 'Lecturer'.

Uploaded by

Ammara Shahzadi
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
55 views

Virtual University of Pakistan: Assignment No. 02 Student Id: Bc210407489

The document describes relations schemas and database relations for a Teacher table and Class table. It asks to represent the relations as tables, and perform relational algebra operations on the tables. The solution represents the relations as two-dimensional tables. It performs the operations of selecting rows from Teacher where Department is 'CS', projecting selected columns from Class, and projecting columns after selecting rows from Teacher where Rank is 'Lecturer'.

Uploaded by

Ammara Shahzadi
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

Virtual University of Pakistan

Assignment No. 02

Student id: Bc210407489


Name: Isha Liaqat
Course Code: Cs403p
Problem Statement: Consider the following relations 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 followingtasks:

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)

1- SOLUTION:

Teacher Table:

Teacher id Name Rank Department Salary


T001 Dr. Najma Professor CS 170000
Waheed
T002 Dr. Nouman Assistant MGT 120000
Masood Professor
T003 Dr. Farhana Professor CS 150000
Khan, Professor
T004 Dr. Tayyaba Ali, Professor CS 140000
Professor
T005 Mr. Nouman Lecturer MGT 80000
Ahmad
T006 Mr. Waqass Lecturer ENG 75000
Raheem

Class Table:

Class Id Course Code Day of Venue Department


Week
A001 CS403 Monday A Block CS

B002 MGT101 Tuesday B Block MGT

C003 ENG201 Monday C Block ENG

B005 CS403 Friday B Block CS

2-SOLUTION: (i)

Teacher id Name Rank Department Salary


T001 Dr. Najma Professor CS 170000
Waheed
T003 Dr. Farhana Professor CS 150000
Khan, Professor
T004 Dr. Tayyaba Ali, Professor CS 140000
Professor

(ii)

Class Id Day of Week Venue

A001 Monday A Block

B002 Tuesday B Block

C003 Monday C Block

B005 Friday B Block

(iii)

Name Rank Department

Mr. Nouman Ahmad Lecturer MGT

Mr. Waqass Raheem Lecturer ENG

You might also like