You are on page 1of 15

EC601 Database System

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

EC601 Database System

TOTAL (CLO 2)

/100

/100

EC601 Database System


CATEGORY PSYCHOMOTOR

17 20

13 16

9 - 12

5-8

1-4

Brings needed materials to class


and is always ready to work. While conducting the procedure, the student is: tidy, respectful of others, mindful of safety and leaves the area clean. Effectively understand and interpret information in lab sheet The question to be answered during the lab is clearly identified and stated Excellent in recognize problem, plan and develop alternative ideas Require less or seldom supervision. Gladly helps other students to follow procedures. Thoroughly and carefully follows each step before moving on to next step. Solutions are accurate and precise Observation are very thorough and may recognize possible errors in data collection Includes appropriate and significant answers. 5

Almost always brings needed


materials to class and is ready to work. While conducting the procedure, the student is: tidy, respectful of others, mindful of safety and leaves the area clean. Understand and interpret information in lab sheet The question to be answered during the lab is identified and stated in somewhat unclear manner Good in recognize problem, plan and develop alternative ideas Required occasionally supervision. Will discuss with peers to solve problems in procedures. Carefully follows each step. Solutions are accurate with reasonable answer Observation are very thorough Includes appropriate and significant answers. 4

Almost always brings needed


materials but sometimes needs to settle down and get to work While conducting the procedure, the student is: mostly tidy, sometimes respectful of others, sometimes mindful of safety, and leaves the area clean only after being reminded. Moderately Understand and interpret information in lab sheet The question to be answered during the lab is partially identified, but stated in somewhat unclear manner Moderate in recognize problem, plan and develop alternative ideas Required occasionally supervision. Will ask peers for help with problems in lab procedures. Works to follow each step before moving on to the next step.

Sometimes always brings needed


materials but needs to settle down and get to work. While conducting the procedure, the student is: not always tidy, sometimes respectful of others, sometimes mindful of safety, and leaves the area clean only after being reminded. Limited understand information in lab sheet The question to be answered during the lab is erroneous or irrelevant Satisfactory in recognize problem, plan and develop alternative ideas Required frequent supervision.

Often forgets needed materials or is


rarely ready to get to work.

While conducting the procedure, the


student is: untidy, not respectful of others, not mindful of safety, and leaves the area messy even after being reminded. Poor understand information in lab sheet The question cannot be answered during the lab Need improve in recognize problem, plan and develop alternative ideas Required frequent supervision. Often requires help from the lecturer to even complete basic procedures.

Preparedness

Operation

Following Procedure

Requires help from lecturer with some steps in procedures.

Practical Work Finding

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

CATEGORY Cognitive Analysis and Theory Application

Analyzes and interprets data:


Able to use appropriate theory. translates theory into practice or applies excellently to process model(s) Communication effectively. Well focused and attention in doing experiment on time given. All important trends and data comparisons have been interpreted correctly and discussed, good understanding of results is conveyed. All important conclusions have been clearly made, student shows

Analyzes and interprets data:


applies appropriate theory to data when prompted to do so. good interprets significance of theory or variable involved. Most communicate. Less focused and attention in doing experiment on time given. Almost all of the results have been correctly interpreted and discussed, only minor improvements are needed.

Analyzes and interprets data:


applies appropriate theory to data when prompted to do so. misinterprets significance of theory or variable involved. Sometime communicate. Almost focused and attention in doing experiment but not on time given. Some of the results have been correctly interpreted and discussed; partial but incomplete understanding of results is still evident. Conclusions regarding major points are drawn, but many are misstated,

Analyzes and interprets data:


make attempt to related data to theory. sometimes makes errors in unit conversions Lacked communication. Not focus and lost attention on several occasions. Very incomplete or incorrect interpretation of trends and comparison of data indicating a lack of understanding of results. Conclusions missing or missing the important points.

Analyzes and interprets data:


make no attempt to related data to theory. makes errors in unit conversions

Teamwork Skills

None communication. Participation


was minimal or student did not doing experiment. There is no discussion attached.

Discussion

Conclusion

All important conclusions have been


drawn, could be better stated.

There is no conclusion attached.

EC601 Database System


good understanding. indicating a lack of understanding.

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)

staffName Anaz Ali Samat Azie Hazlim

Position Programmer Web developer Programmer Web developer Technical support

Year 2 4 4 3 2

Select only Position as a Web developer

ANSWER General statement i. __________________________________________________________ ii. __________________________________________________________

EC601 Database System Output staffNo 00500 00444 staffName Ali Azie Position Web developer Web developer Year 4 3

b)

Select only Position=Programmer and Year > 2

ANSWER General statement i. __________________________________________________________ ii. __________________________________________________________ Output STAFF2 staffNo 00689

staffName Samat

Position Programmer

Year 4

EC601 Database System

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

custName Adam & co TegasTulinSdnBhd WangsaMewangiSdnBhd WawasanSdnBhd Halim& Son SdnBhd

projectNo 1 2 2 5 3

staffNo 00111 00123 00123 00999 00689

(a) Get a list of all customer number and customer name ANSWER General statement i. __________________________________________________________ ii. __________________________________________________________ Output

custNo C001 C010 C011 C007 C021

custName Adam & co TegasTulinSdnBhd WangsaMewangiSdnBhd WawasanSdnBhd Halim& Son SdnBhd

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

StudentName Ahmad Salmah Zanita Ai Ling Raju Monaj TengKiat Yamin

LecId 3120 3333 5123 1273 6545 7777 5123 1273

(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

3120 3333 5123 1273 6545 7777 5123

1111 2222 3333 4444 5555 6666 7777

Ahmad Salmah Zanita Ai Ling Raju Monaj TengKiat

Badariah Zanita Khairul Yogess Najwa TengKiat Khairul

3101 2113 0101 2211 3418 3101 0101

Johor Pahang Selangor Johor Sarawak Sabah Selangor

2300 4000 3200 1865 5050 2300 3200

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

ANSWER General statement i. __________________________________________________________ ii. __________________________________________________________ Output


projectNo 1 1 1 2 2 2 3 3 3 projectName DADD DADD DADD Programming Programming Programming Multimedia Multimedia Multimedia Cost 1 000 000 1 000 000 1 000 000 500 000 500 000 500 000 8000 8000 8000 staffNo 00689 00500 00111 00689 00500 00111 00689 00500 00111 staffName Samat Ali Anaz Samat Ali Anaz Samat Ali Anaz Position Electric engineer Web developer Programmer Electric engineer Web developer Programmer Electric engineer Web developer Programmer

EC601 Database System

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

Name Ahmad Salmah Zanita Ai Ling Raju Monaj TrngKiat Yamin

Age 18 19 18 18 19 20 19 18

Sex M F F F M M M M

State Penang Johor Pahang Perak Johor Penang Sabah Kedah

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.

projectName DADD Programming Multimedia

Cost 1 000 000 500 000 8000

EC601 Database System ii.

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

Name Ahmad Salmah Zanita Ai Ling Raju Monaj TrngKiat Yamin

Age 18 19 18 18 19 20 19 18

Sex M F F F M M M M

State Penang Johor Pahang Perak Johor Penang Sabah Kedah

LECTURER Id_Lec 3120 3333 5123 1273 6545 7777

Lec_Name Badariah Zanita Khairul Yogess Najwa TengKiat

Subject 3101 2113 0101 2211 3418 3101

State Johor Pahang Selangor Johor Sarawak Sabah

Salary 2300 4000 3200 1865 5050 2300

Sex F F M F F M

SUBJECT Subject_Code 0101 2113 3418 2211 3101

Subject_Name C++ Fundamental of IT Database System Computer Hardware Network Security

Lecturer Khairul Zanita Najwa Yogess TengKiat

Credit_Hours 3 2 4 2 2

EC601 Database System

SUPERVISOR Id_Student 1111 2222 3333 4444 5555 6666 7777 8888 Instructions:

StudentName Ahmad Salmah Zanita Ai Ling Raju Monaj TengKiat Yamin

LecId 3120 3333 5123 1273 6545 7777 5123 1273

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

2. LECTNAMES Lec_Name, Subject, Id_Lec (FEMALE_LECTURER)

Id_Lec 3120 3333 1273 6545

Lec_Name Badariah Zanita Yogess Najwa

Subject 3101 2113 2211 3418

EC601 Database System

3. LECT_DEPENDENTS LECTNAMES X SUPERVISOR

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

EC601 Database System

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)

StudentName Ahmad Salmah Ai Ling Yamin Raju

EC601 Database System

DISCUSSION

Discuss and explain the result generated from the practical work 3 and what you have learned from this practical work.
CONCLUSION

Give conclusion from the discussion and practical work result.

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: .