

Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!


CS403: Database Management Systems Spring 2012 Assignment No. 2 Solution File
Virtual University Of Pakistan
Assignment No. 02 Total Marks: 10
D 1 => Set of first two Vowels = D 1 = {A, E} D 2 => Set of three country codes = D 2 = {213,54, 994} D 3 => Set of first three odd numbers = D 3 = {1, 3, 5}
Solution: D 1 ร D 2 ร D 3 = 2 ร 3 ร 3 = 18 Subsets
Where 2 represent the number of elements in set D1, 3 for D 2 and again 3 for D 3.
D 1 ร D 2 ร D 3 = (A,213,1),(A,213,3),(A,213,5)(A,54,1), (A,54,3),( A,54,5),(A,994,1),(A,994,3),( A,994,5),
(E,213,1),(E,213,3), (E,213,5),(E,54,1),(E,54,3),(E,54,5),(E,994,1),( E,994,3),(E,994,5)
(b). Keeping in view the previous assignment scenario lets suppose there is a simple database for some entities in LMS might contain relations for Student, Class, Faculty and Enrollment. The relation schema would be written as:
Student (Stu_Id, LastName, FirstName, Major, Credits) Faculty (Fac_Id, department, rank, name) Class (Class_No, Fac_Id, Schedule, room) Enrollment (Stu_Id, Class_No, Grade)
Using this sample relational schema, identify foreign key in Class relation and Composite primary key in
CS403: Database Management Systems Spring 2012 Assignment No. 2 Solution File
Virtual University Of Pakistan
Solution: 1. Keeping in mind the definition of foreign key, here Fac_Id would behave as a
foreign key in Class relation as it is used as primary key in the Faculty relation. This
attribute will also be used to join these two relations (Faculty and Class).
2. Stu_Id and Class_No will jointly behave as composite primary key in
Enrollment relation.