Professional Documents
Culture Documents
DEPARTMENT OF ELECTRICAL ENGINEERING EC601 DATABASE SYSTEM SESSION: JUNE 2013 Program: DTK 6 LAB 3: RELATIONAL DATA MODEL Duration: 2 Hours NAME 1. 2. ID NO MARKS
Learning Outcomes By the end of this laboratory session, students should be able to: Apply structured query language (SQL) for database manipulation using a database management system in practical works. (P4). Objectives: 1. Define and apply the fundamental operators from relational databases. 2. Use the operators. Hardware/ Software : Personal Computer / Program Application (Microsoft Access 2007)
PRACTICAL WORK ASSESSMENT RUBRICS CATEGORY SKILLS STUDEN STUDEN T1 T2 /20 /20 /20 /20 /20 /5 /5 /5 /5 /20 /20 /20 /5 /5 /5 /5
Psychomot 1. Preparedness or (80%) 2. Operation 3. Following Procedure 4. Practical Work Finding Cognitive (20%) 1. Analysis and Theory Application 2. Teamwork Skills 3. Discussion 4. Conclusion
TOTAL (CLO 2)
/100
/100
17 20
13 16
9 - 12
5-8
1-4
Preparedness
Operation
Following Procedure
Solutions are mostly accurate Observation are generally complete Only 2 or 3 minor errors in the answers.
Solutions are somewhat inaccurate and very precise Observation are incomplete or recorded in confusing way There are 3 or more minor errors in the answers. 2
Solutions are incomplete, inaccurate and imprecise Observation are incomplete or not included Answers are not included 1
Teamwork Skills
Discussion
Conclusion
EC601 Database System THEORY : A Relation is a mathematical concept based on the ideas of sets. The model was first proposed by Dr. E.F. Codd of IBM Research in 1970 in the following paper: A Relational Model for Large Shared Data Banks," Communications of the ACM, June 1970.Relational algebra is the basic set of operations for the relational model. These operations enable a user to specify basic retrieval requests (or queries). The result of an operation is a new relation, which may have been formed from one or more input relations. Relational Algebra consists of several groups of operations Unary Relational Operations SELECT (symbol: (sigma)) PROJECT (symbol: (pi)) RENAME (symbol: (rho)) Relational Algebra Operations From Set Theory UNION (), INTERSECTION ( ), DIFFERENCE (or MINUS, ) CARTESIAN PRODUCT ( x )
PROCEDURE : Write the general form of all the statements below using Relational Algebra symbol. Then, based on appropriate table, generate the output. 1. SELECT SELECT is used to obtain a subset of the tuples of a relation that satisfy a select condition. STAFF2 staffNo 00111 00500 00689 00444 00123 (a)
Year 2 4 4 3 2
EC601 Database System Output staffNo 00500 00444 staffName Ali Azie Position Web developer Web developer Year 4 3
b)
ANSWER General statement i. __________________________________________________________ ii. __________________________________________________________ Output STAFF2 staffNo 00689
staffName Samat
Position Programmer
Year 4
2. PROJECT The PROJECT operation is used to select a subset of the attributes of a relation by specifying the names of the required attributes. CUSTOMER custNo C001 C010 C011 C007 C021
projectNo 1 2 2 5 3
(a) Get a list of all customer number and customer name ANSWER General statement i. __________________________________________________________ ii. __________________________________________________________ Output
3. JOIN
EC601 Database System JOIN is used to combine related tuples from two relations: In its simplest form the JOIN operator is just the cross product of the two relations. As the join becomes more complex, tuples are removed within the cross product to make the result of the join more meaningful. JOIN allows you to evaluate a join condition between the attributes of the relations on which the join is undertaken.
LECTURER Id_Lec Lec_Name Subject State 3120 Badariah 3101 Johor 3333 Zanita 2113 Pahang 5123 Khairul 0101 Selangor 1273 Yogess 2211 Johor 6545 Najwa 3418 Sarawak 7777 TengKiat 3101 Sabah Salary 2300 4000 3200 1865 5050 2300
Id_Student 1111 2222 3333 4444 5555 6666 7777 8888 SUPERVISOR
(a) Join table LECTURER and SUPERVISOR where Id_Lec equal to LecId. ANSWER General statement i. __________________________________________________________ ii. __________________________________________________________ Output
Id_Lec = LecId Id_Student StudentName Lec_Name Subject State Salary
EC601 Database System 1273 8888 Yamin Yogess 2211 Johor 1865
4. CARTESIAN PRODUCT This operation is used to combine tuples from two relations in a combinatorial fashion STAFF1 staffNo 00689 00500 00111 PROJECT projectNo 1 2 3 projectName DADD Programming Multimedia Cost 1 000 000 500 000 8000 staffName Samat Ali Anaz Position Electric engineer Web developer Programmer
LABORATORY EXERCISE Based on given table, answer all questions. 1) Select the STUDENT tuples whose Age number is 18 and State is Pahang: STUDENT Id_Student 1111 2222 3333 4444 5555 6666 7777 8888
Age 18 19 18 18 19 20 19 18
Sex M F F F M M M M
ANSWER General Statement: i. ii. Output Id Student 3333 2) Name Zanita Age 18 Sex F State Pahang
Get a list of all project name and cost PROJECT projectNo 1 2 3 ANSWER General Statement: i.
Output PROJECT projectName DADD Programming Multimedia Cost 1 000 000 500 000 8000
QUESTION Answer the questions below by referring to the tables given. STUDENT Id_Student 1111 2222 3333 4444 5555 6666 7777 8888
Age 18 19 18 18 19 20 19 18
Sex M F F F M M M M
Sex F F M F F M
Credit_Hours 3 2 4 2 2
SUPERVISOR Id_Student 1111 2222 3333 4444 5555 6666 7777 8888 Instructions:
Draw the tables according to the relational algebra symbols below. 1. FEMALE_LECTURER sex='F' (LECTURER) Id_Lec 3120 3333 1273 6545 Lec_Name Badariah Zanita Yogess Najwa Subject 3101 2113 2211 3418 State Johor Pahang Johor Sarawak Salary 2300 4000 1865 5050 Sex F F F F
Id_Lec 3120 3120 3120 3120 3120 3120 3120 3120 3333 3333 3333 3333 3333 3333 3333 3333 1273 1273 1273 1273 1273 1273 1273 1273 6545 6545 6545 6545 6545 6545 6545 6545
Lec_Name Badariah Badariah Badariah Badariah Badariah Badariah Badariah Badariah Zanita Zanita Zanita Zanita Zanita Zanita Zanita Zanita Yogess Yogess Yogess Yogess Yogess Yogess Yogess Yogess Najwa Najwa Najwa Najwa Najwa Najwa Najwa Najwa
Subject 3101 3101 3101 3101 3101 3101 3101 3101 2113 2113 2113 2113 2113 2113 2113 2113 2211 2211 2211 2211 2211 2211 2211 2211 3418 3418 3418 3418 3418 3418 3418 3418
Id_Student 1111 2222 3333 4444 5555 6666 7777 8888 1111 2222 3333 4444 5555 6666 7777 8888 1111 2222 3333 4444 5555 6666 7777 8888 1111 2222 3333 4444 5555 6666 7777 8888
StudentName Ahmad Salmah Zanita Ai Ling Raju Monaj TengKiat Yamin Ahmad Salmah Zanita Ai Ling Raju Monaj TengKiat Yamin Ahmad Salmah Zanita Ai Ling Raju Monaj TengKiat Yamin Ahmad Salmah Zanita Ai Ling Raju Monaj TengKiat Yamin
LecId 3120 3333 5123 1273 6545 7777 5123 1273 3120 3333 5123 1273 6545 7777 5123 1273 3120 3333 5123 1273 6545 7777 5123 1273 3120 3333 5123 1273 6545 7777 5123 1273
4. ACTUAL _DEP Id_Lec=LecId (LECT_DEPENDENTS) Id_Lec = LecId 3120 3333 1273 1273 6545 Id_Student Lec_Name Badariah Zanita Yogess Yogess Najwa Subject 3101 2113 2211 2211 3418 1111 2222 4444 8888 5555 StudentName Ahmad Salmah Ai Ling Yamin Raju
5.
RESULT LectName, Subject, StudentName Lec_Name Badariah Zanita Yogess Yogess Najwa Subject 3101 2113 2211 2211 3418
(ACTUAL_DEP)
DISCUSSION
Discuss and explain the result generated from the practical work 3 and what you have learned from this practical work.
CONCLUSION
Prepared by: ... . Isma Shamsuria Bt Ismail Course Coordinator Database System (EC601) Department of Electrical Engineering
Verified by:
Prepared by: ... ShamsiahBintiSalamat Course Coordinator Database System (EC601) Department of Electrical Engineering
Verified by: .