Você está na página 1de 3

KELANA JAYA STUDY CENTRE 18-5 PLAZA CCL, JALAN PERBANDARAN SS6/12 KELANA JAYA URBAN CENTRE 47301

KELANA JAYA

FINAL EXAMINATION JANUARY 2007


mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm

COURSE TITLE COURSE CODE DATE/DAY TIME/DURATION

: : : :

DATABASE CSB2014/CSD2014 12 MAY 2007/SATURDAY 9.00 AM 12.00 AM / 3 HOURS

mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm

INSTRUCTIONS TO CANDIDATES:
1. 2. 3. 4. This Question Booklet consists of TWO (2) Sections, Section A and B. Answer ALL Questions in Section A and ALL Questions in Section B. Answer ALL questions in Section A and Section B in the Answer Booklet. Candidates are not allowed to bring into the examination hall/room any form of written materials or electronic gadget except for stationery that is permitted by the Invigilator. 5. Students who are caught breaching the Examination Rules and Regulation will be charged with an academic dishonesty, and if found guilty of the offence, the maximum penalty is expulsion from the University.

(This Question Paper consists of 3 Printed Pages)

*** DO NOT OPEN THE QUESTION PAPER UNTIL YOU ARE TOLD TO DO SO ***

Database (CSB2014/CSD2014) January 2007 Final Examination

CONFIDENTIAL

SECTION A There are FOUR (4) questions in this part. Answer ALL questions.

(20 Marks)

1. a) In a traditional file processing system, the program code is dependent on how the data is structured and stored. What are the problems that arise because of this dependency? (4 marks) b) How do database management systems (DBMSs) overcome the above limitation of traditional file processing systems? (4 marks) 2. What is an associative entity? Explain with an example. (5 marks) 3. a) What is the difference between a primary key constraint and a unique constraint? (2 marks) b) Can we drop a primary key on a table that has foreign keys pointing to it? (1 mark) 4. What is the difference between dropping and truncating a table? (4 marks)

SECTION B There are THREE (3) questions in this section. Answer ALL questions.

(80 Marks)

1. Draw an Entity-Relationship (E-R) diagram for the UNITAR database which follows the following business rules: UNITAR has a number of different people working in it. It needs to maintain the information of the following attributes for all the people : Identity Number (ID), Name, Address, Telephone. A person can either be a student or a staff. A student has a CGPA and one or more hobbies he likes to pursue. A staff has one or more dependents (his/her children). Dependents have a name and an age attribute. A staff is associated with a department with each department being characterized by a dept. number, dept. name and head. A staff personnel is categorized as being either an academic staff or non-academic staff. An academic staff has one or more research areas he likes to pursue. A non-academic staff has one or more skills. A course has a course code, course name and may have one or more prerequisite courses. UNITAR also has a number of faculties in it with each faculty being characterized by a faculty name and location. A faculty offers different courses in each semester. A student registers for one or more courses during the semester that it is offered. The grade obtained by a student during a semester in each course is recorded. The date and time of registration also need to be stored in the system. Each registration needs to be billed. The billing consists of an invoice number, the amount and is managed by a finance personnel who is a non-academic staff. (Note : Your diagram should specify entities, relationships, attributes, keys, mapping cardinalities, associative entities and existential dependencies). (18 marks) 2. Transform the E-R diagram in question number 1 above into a set of relations (tables). Show the primary key and foreign key relationships among the tables. (12 marks)

Database (CSB2014/CSD2014) January 2007 Final Examination

CONFIDENTIAL

3. Based on the two tables given below, write the Structured Query Language (SQL) commands to do the following: EMP TABLE Column Name EMPNO ENAME JOB MGR SAL COMM DEPTNO DEPT TABLE Column Name DEPTNO DNAME LOC

DataType NUMBER(4) VARCHAR2(20) CHAR(10) NUMBER(4) NUMBER(9,2) NUMBER(7,2) NUMBER(2)

Constraint PRIMARY KEY NOT NULL REFERENCES EMPNO

REFERENCES DEPT(DEPTNO) Constraint PRIMARY KEY NOT NULL

DataType NUMBER(2) VARCHAR2(20) VARCHAR2(20)

a) Create the above two tables (along with the appropriate constraints). (6 marks) b) Select the employee number, employee name, job, department number and department name of all employees who have a salary less than 1000. (4 marks) c) Create a new table named MY_EMP which has the same structure as table EMP but no data. What constraints will the table MY_EMP have? (4 marks) d) Insert all rows in table MY_EMP from table EMP for which the DEPTNO is either 10 or 20. (3 marks) e) Grant all privileges on employees belonging to department number 10 in EMP to user1. (4 marks) f) List the total salary, maximum and minimum salary and the average salary of all employees job wise for each department. (5 marks)

g) List the name of the employee drawing the highest salary. (4 marks) h) List the job with highest average salary. (5 marks) i) List the details of the lowest paid manager. (5 marks) j) Write a Procedural Language (PL/SQL) procedure to update the commission of an employee in the EMP table. The steps of the procedure are as follows: i. The employee number is passed to the procedure as a parameter. ii. If the employee is a manager, his commission is 20% of his salary or if the employee is an analyst his commission is 15% of his salary or if the employee is a clerk his commission is 10% of his salary. iii. The employee number, name and new commission values are saved in another table named UPDATED_COMMISSION. (10 marks) *** END OF QUESTION PAPER ***

Você também pode gostar