Vous êtes sur la page 1sur 3

UNIVERSITY OF LAGOS

FACULTY OF ENGINEERING
DEPARTMENT OF ELECTRICAL AND ELECTRONICS ENGINEERING
B.Sc. (Hons.) COMPUTER ENGINEERING DEGREE EXAMINATIONS
CPE 502: DATABASE MANAGEMENT SYSTEM
SECOND SEMESTER, 2013/2014 ACADEMIC SESSION
Instructions: This Examination has two sections (A and B).
Answer two questions in Part A and ONLY ONE question in Part B.
Total Time Allowed: 2 Hours

SECTION A - Theory (45 Minutes)


Answer two questions

Question One
(a) Define the following terms: entity, attribute, key, relationship, Exec statement in SQL.
[7 marks]

(b) A university database consists of information about departments (identified by Department


Identification Number or DIN with dname and budget as attributes) and employees (identified
by Staff Identification or SID with name and address as attributes). Employees work in
departments; each department has exactly one manager, although a single employee is allowed
to manage more than one department. Draw an ER diagram that captures the information
about the university. Use only the basic ER model here, that is, entities, relationships and
attributes. Be sure to indicate any key and participation constraints. [5 marks]

(c) (i) In the Structure Query Language, differentiate between:


(i) WHERE and HAVING clauses [2 marks]
(ii) DROP and DELETE [2 marks]

(ii) State the SQL Trigger syntax [4 marks]

Question Two
(a) Differentiate between relational algebra and relational calculus. [4 marks]

(b) (i) Explain the transformation rules that apply to


(a) Selection [2 marks]
(b) Projection [2 marks]

1
(ii) Consider the relations given below with keys underlined
Institution (InsName, street, city)
Staff (staffNo, name, salary, InsName, position, DOB)
propertyForRent (propertyNo, staffNo, rent)
Answer the following queries in relational algebra
(i) Find the names of Staff who work in Akoka campus of the University of Lagos.
[3 marks]
(ii) List the staffNo of Staff who have not rent any property. [3 marks]

(c) Describe the structure of a well formed formulae in relational calculus. [6 marks]

Question Three
(a) Explain the difference between the three storage types volatile, non-volatile and
stable. [6 marks]

(b Define the following terms:


(i) a hashing function. [2 marks]
(ii) a B-tree. [2 marks]
(c) State three:
(i) disadvantages of file-processing system? [5 marks]
(ii) differences between primary index and secondary index? [5 marks]

2
SECTION B Programming Problems (75 Minutes)
Answer ONLY ONE question

Question Four
Write SQL scripts to:

a) Show the structure of the tables in Table 1. Select all data from the tables. [30 marks]

b) Show the department names, locations, names, job titles, and salaries of employees who
work in location 1800. [15 marks]

c) produce a list of employees showing raise percentages, employee IDs and old salary, and new
salary increase. Employees in department 10 are given a 15% raise while employees in
department 60 are not given. [15 marks]
[Hint: Use CSV files to import data into MySQL table]

Question Five
Write SQL scripts to:

a) show the structure of the table in Tables 2 and 3. Select all data from the table 2. [30 marks]

b) create a trigger function with activation time prior to the update events on the students
table. [15 marks]

c) perform three update events on the students table and select all data from the
students_check table. [15 marks]
[Hint: Use CSV files to import data into MySQL table]

Vous aimerez peut-être aussi