Presentation is loading. Please wait.

Presentation is loading. Please wait.

1 Test1 N = {n: n is an integer and n  0} X = {x: x = n + 5, where n  N} Y = {y: y = 7 * n - 1, where n  N} List the three smallest elements of each.

Similar presentations


Presentation on theme: "1 Test1 N = {n: n is an integer and n  0} X = {x: x = n + 5, where n  N} Y = {y: y = 7 * n - 1, where n  N} List the three smallest elements of each."— Presentation transcript:

1 1 Test1 N = {n: n is an integer and n  0} X = {x: x = n + 5, where n  N} Y = {y: y = 7 * n - 1, where n  N} List the three smallest elements of each set. N X Y 0 5 -1 1 6 6 2 7 13

2 2 Test1 N = {n: n is an integer and n  0} X = {x: x = n + 5, where n  N} Y = {y: y = 7 * n - 1, where n  N} Give the formula of a mapping between X and Y. The formula cannot contain n. x = n + 5 n = x – 5 y = 7 * n – 1 = 7 * (x – 5) – 1 = 7x - 36

3 3 Test1 DrivingClass (ClientNo, ClientName, InstructorNo, InstructorName, ClassDate, ClassTime, CarID) Which of the following are correct functional dependencies? CarNo, ClassDate  InstructorNo YesNo InstructorNo, ClassDate, ClassTime  CarNo YesNo InstructorName  InstructorNo YesNo

4 4 Test1 DrivingClass (ClientNo, ClientName, InstructorNo, InstructorName, ClassDate, ClassTime, CarID) Which of the following is a candidate key? CarNo, ClassDate, ClassTime YesNo InstructorNo, ClientNo, ClassDate YesNo

5 5 Test1 Branch (Bno, Street, City, State, Tel_No, Fax_No) Staff (Sno, FirstName, LastName, Address, Tel_No, Bno) Client (ClientNo, Name, StreetAddress, City, State, Gender) DrivingClass (ClientNo, Sno, ClassDate, ClassTime, CarID) Car (CarID, Make, Model, Year, Mileage, LastInspectionDate) List the client information (ClientNo, Name, Gender) with the instructor information (FirstName, LastName) for all scheduled driving classes for the current date that use a 2012 Chevrolet Cruze. The query must produce correct result for any day without modification.

6 6 Test1 Branch (Bno, Street, City, State, Tel_No, Fax_No) Staff (Sno, FirstName, LastName, Address, Tel_No, Bno) Client (ClientNo, Name, StreetAddress, City, State, Gender) DrivingClass (ClientNo, Sno, ClassDate, ClassTime, CarID) Car (CarID, Make, Model, Year, Mileage, LastInspectionDate)  (Client.ClientNo,Name,Gender,FirstName,LastName)  (ClassDate = CurrentDate() and Make = ‘Chevrolet’ and Model = ‘Cruze’ and Year = 2012) (Client (Staff (DrivingClass Car)))

7 7 Test1 Branch (Bno, Street, City, State, Tel_No, Fax_No) Staff(Sno, FirstName, LastName, Address, Tel_No, Bno) Client(ClientNo, Name, StreetAddress, City, State, Gender) DrivingClass (ClientNo, Sno, ClassDate, ClassTime, CarID) Car(CarID, Make, Model, Year, Mileage, LastInspectionDate)  (Client.ClientNo,Name,Gender,FirstName,LastName)  (ClassDate = CurrentDate() and Make = ‘Chevrolet’ and Model = ‘Cruze’ and Year = 2012) (Client Staff DrivingClass Car) Cannot Join Client and Staff!

8 8 Test1 Derive table schemas for the following entities with a one-to-many relationship. Use DBDL to specify the table schemas. E1 E2 A1 B1 A2 B2 A3: composite (A31, A32) B3: composite (B31, B32) A4 multi-value PK: (A1, A2) PK: B1 AK: None E1 (0..1) ----- IsRelatedTo ----- E2 (1..*) Attribute: C1, C2

9 9 E1(A1,A2,A31,A32,A4) PK: A1,A2 AK: NONE FK: NONE E2(B1,B2,A1,A2,C1,C2) PK: B1 AK: NONE FK: A1,A2 references E1 E2(NewID,B1,B31, B32) PK: NewID AK: NONE FK: B1 references E2

10 10 Decompose the following relation into 3NF. Assume it is in 1NF. P (A, B, C, D, E, F) PK A, B, C AK: NONE FK: NONE Functional Dependencies: A, B, C  All A  E D  F

11 11 P2(A,E) PK: A AK: NONE FK: NONE FDs: A  E P3(D,F) PK: D AK: NONE FK: NONE FDs: D  F AE C800 C7010 DF 9X 4Y

12 12 P2(A,E) PK: A AK: NONE FK: NONE FDs: A  E P3(D,F) PK: D AK: NONE FK: NONE FDs: D  F AE C800 0 0 C7010 DF 9X 9X 4Y 4Y No Duplicate Records!

13 13 P (A, B, C, D) PK A, B, C AK: NONE FK: A references P2 D references P3 FDs: A, B, C  All ABCD C80100109 C80300209 C80300104 C70100204

14 14 Decompose the table into BCNF. Q (X, Y, Z, U, V, W, Q) PK: X, Y, Z AK: U, V, W Functional Dependencies: X, Y, Z  All U, V, W  All U, V  X W  Q

15 15 Q2(W,Q) PK: W AK: NONE FK: NONE FDs: W  Q Q3(U, V, X) PK: U, V AK: NONE FK: NONE FDs: U, V  X WQ N12.5 N23.2 N33.2 UVX 1080 2270 1180

16 16 Q (Y, Z, U, V, W) PK U, V, W AK: NONE FK: W references Q2 (U, V) references Q3 FDs: U, V, W  All YZUVW M1410010N1 M1410022N2 M1420022N3 M1430011N1 M1440010N2


Download ppt "1 Test1 N = {n: n is an integer and n  0} X = {x: x = n + 5, where n  N} Y = {y: y = 7 * n - 1, where n  N} List the three smallest elements of each."

Similar presentations


Ads by Google