Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
KELANA JAYA
*** DO NOT OPEN THE QUESTION PAPER UNTIL YOU ARE TOLD TO DO SO ***
CONFIDENTIAL
SECTIONA There are FOUR(4) questions in this part. Answer ALL questions. 1. Distinguish between the terms Data, Database and Database Management System.
(20 Marks)
(3 marks) 2. List any TWO (2) disadvantages of using the traditional file processing approach for storing and accessing data and explain how database management systems (DBMSs) overcome these limitations. (8 marks) What is an associative entity? Explain with an example. (6 marks) 4. What are the types of numbers that can be stored in each of the following datatype declarations? a. NUMB ER(5) b. NUMBER(5,2) c. NUMBER (3 marks)
3.
SECTION B There are THREE (1) questions in this section. Answer ALL questions. 1.
(80 Marks)
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, a staff or an alumnus . 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. An alumnus has one or more degrees which he has taken from UNITAR. 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 student takes many courses depending on the program in which he is enrolled. A course has a course code, course name and is supervised by a lecturer who is an academic staff. UNITAR also has a number of faculties in it with each faculty being characterized by a faculty name and location . A faculty offers different programs and has different departments within it. A faculty is headed by a dean who is an academic staff. (Note : For determining the cardinality of relationships, use the business rules of UNITAR as it stands today). (20 marks)
2.
Based on the E-R model in question number 1 above, draw the relations(tables) for the following entities: Person Student Alumnus Staff Faculty Department Show the primary key foreign key relationships among them . (10 marks)
CONFIDENTIAL
3.
EMP TABLE Column Name EMPNO ENAME JOB MGR SAL COMM DEPTNO
REFERENCES DEPT(DEPTNO)
Write the SQL commands to do the following: a. Create the above two tables (along with the appropriate constraints). (6 marks) b. Select the employee number, employee name, job, department number and departme nt name of all employees who are MANAGERS. (5 marks) Create a new table named MY_EMP which has the same structure as table emp but no data. (3 marks) Insert all rows in table MY_EMP from table emp for which the deptno is either 10 or 20. (3 marks) e. Grant select privilege on table emp to user1 and allow him to give further grants. (4 marks) f. List the total salary, maximum and minimum salary and the average salary of employees job wise for department number 10. (5 marks) 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 highest paid em ployee of each department. (5 marks) j. Write a PL/SQL procedure to delete an employee from the EMP table. The steps of the procedure are as follows: a. The employee number is passed to the procedure as a parameter. b. The employee number and name of the employee in the deleted record are saved in another table called FORMER_EMP. c. The record is deleted from the EMP table. d. The delete_date column in the FORMER_EMP table is updated with the current system date. (10 marks) *** END OF QUESTION PAPER ***
c.
d.
g.