Introduction to Database Systems - Exam

THE UNIVERSITY OF DODOMA

COLLEGE OF INFORMATICS AND VIRTUAL EDUCATION
SCHOOL OF INFORMATICS

UNDERGRADUATE UNIVERSITY EXAMINATIONS
SECOND SEMESTER 2017/2018

CS 125: INTRODUCTION TO DATABASE SYSTEMS
Date: 05th July, 2018
Time Allocated: 3 Hours


SECTION A (60 Marks)

Question One

Define the following terms as used in Database System

a) Database

b) Database Management System

c) Primary key

d) Foreign key

e) Super key


Question Two

a) Differentiate the following terms
i) First Database Normal form (1NF) and second Database Normal form (2NF)
(2 Marks)

ii) Insertion anomaly and Update anomaly
(3 Marks)

b) Briefly explain the main goal of database normalization when design the database
(2 Marks)

c) An engineering consultancy firm supplies temporary specialized staff to bigger companies in the country to work on their project for certain amount of time. The table below lists the time spent by each of the company’s employees at other companies to carry out projects. The National Insurance Number (NIN) is unique for every member of staff.
(3 Marks Each)

NINContract NoHoursEmployee NameCompany IDCompany Location
616681BSC102572P. WhiteSC115Belfast
674315ASC102548R. PressSC115Belfast
323113BSC102624P. SmithSC23Bangor
616681BSC102624P. WhiteSC23Bangor

i. Find the Primary Key (PK) for this relation and explain your choice

ii. Find fully functional dependencies on the PK and the partial functional dependencies on the PK

iii. Normalize the table to 2NF

iv. Find the transitive dependencies on the 2NF tables


Question Three

a) Define view as used in Database Management System.
(1 Mark)

b) State three roles of View in a Database Management System?
(3 Marks)

c) In spite of the advantages of using a DBMS, there are a few situations in which such a system may involve unnecessary overhead costs that would not be incurred in traditional file processing. Briefly explain three factors that may lead to overhead costs in DBMS
(6 Marks)


Question Four

Read the following scenario carefully and then answer the questions that follow:

The college of Informatics and Virtual Education has several departments. Each department is managed by a chair, and at least one professor. Professors must be assigned to one, but possibly more departments. At least one professor teaches one course, but a professor may be on sabbatical and not teach any course. Each course may be taught more than once by different professors. We know of the department name, the professor name, the professor employee id, the course names, the course schedule, the term/year that the course is taught, the departments the professor is assigned to, the department that offers the course.

a. Draw the ERD
(4 Marks)


b. From the ERD above draw the logical schema
(4 Marks)

c. From the logical schema above create at least data dictionaries
(4 Marks)

d. From the data dictionaries above create at least two physical schema
(4 Marks)


SECTION B (40 Marks)

Question Five

a. What is a data model? Briefly explain the two types of data model.
(4 Marks)

b. Define database schema and briefly explain three types of schema in a database.
(4 Marks)

c. With examples, give two differences between DDL and DML.
(4 Marks)

d. Define the term “database integrity”. How does database integrity differ from database security?
(4 Marks)

e. With the aid of a well-drawn diagram, point out three advantages of using ANSI/SPARK architecture over the 2-tier architecture.
(4 Marks)


Question Six

Given the following database schemas
Emp(empno, Ename, Job, sal, deptno, mgr, comm, hiredate)
Dept(deptno, dname, loc)
Salgrade(grade, hisal, losal)

Required: Write SQL statements to solve the following

a. Make grade column to become a primary key in the schema Salgrade
(1 Mark)

b. Add column grade with the data type number and size of 2 in the schema emp
(2 Marks)

c. Make grade column in the schema emp a foreign key from schema salgrade
(2 Marks)


d. Modify the data type of column deptno in schema dept from number (2) to varchar2(10)
(3 Marks)

e. Write the query to display employee name and salary of all employees who are working in department number 10
(2 Marks)

f. Display the manager number and the salary of the lowest paid employee for that manager. Exclude anyone whose manager is not known. Exclude any groups where the minimum salary is less than $1000. Sort the output in descending order of the salary.
(4 Marks)

g. Display the employee name and employee number along with their manager’s name and manager number. Label the columns Employee, Emp#, Manager, and Mgr# respectively.
(4 Marks)

h. Display the name, salary and commission for all employees who earn commission. Sort data in descending order of salary and commission.
(2 Marks)


Question Seven

a. List and explain any three types of integrity constraints in database system
(3 Marks)

b. Consider the following relational schema and answer each of the following questions briefly
Emp(eid: integer, ename: string, age: integer, salary: real)
Works(eid: integer, did: integer, pct_time: integer)
Dept(did: integer, dname: string, budget: real, managerid: integer)

i). Give an example of a foreign key constraint that involves the Dept relation. What are the options for enforcing this constraint when a user attempts to delete a Dept tuple?
(4 Marks)

ii). Define the Dept relation in SQL so that every department is guaranteed to have a manager.
(3 Marks)

iii). Create updatable view from Emp relation that contains employees with salary greater than 100,000
(3 Marks)

iv). Create a non-updatable view that combine Emp and Works relations with pct_time less than 4 hrs and age greater than 25
(2 Marks)

c. Briefly describe the five components of the DBMS environment
(5 Marks)


END OF EXAMINATION PAPER