NATIONAL INSTITUTE OF BUSINESS MANAGEMENT
Diploma in Computer System Design 2015.3
Diploma in Software Engineering 2015.2
Diploma in Computer Networks 2015.2
DATABASE MANAGEMENT SYSTEMS –DCSD 105
26th February 2016, 09.00am to 12.00noon
Answer All questions.
Time: THREE hours.
The marks given in brackets are an indicative of the weight given to each part of the question
1)
a) Describe the advantages of having a database in a business organization.
b) Explain the 3 schema architecture with a suitable diagram.
c) What is the difference between a table and a view in a database?
d) Explain the primary key and foreign key in a table with a suitable example.
e) Explain 3 different attribute types with the symbols and suitable examples.
(20 Marks)
2) Consider the following requirements given to build a database.
A university consists of a number of faculties. Each faculty will be offering several courses. A
facultyis identified by a unique faculty number, facultyname and a location and for a course a
unique course identification number, course name, duration and course fee will be stored in the
database.
There are many modules in a course. For a module the database stores a distinct module code,
module name, duration and the type of the module.
Students can enroll in a particular course and take modules towards the completion of that
course. For all the students in the universitya unique student number, student name, address, date
of birth, age and telephone number should be recorded in the database.
The students can be categorized into two groups as full time students and part time students. The
full time students will be submitting assignments. For each assignment the date of submission
will be recorded in the database. For all the part time students the email address will be stored in
the database.
Each module is taught by a lecturer, and each lecturer teachesseveralmodules. For all the
lecturers, lecturer code, name of the lecturer, qualifications will be recorded. The number of
hours each lecturer tutors a subject is also stored in the database.
Page 1 of 3
Draw an EER diagram and use the relational mapping rules to create a linked relational schema. State
any assumptions you make. Indicate the primary keys and foreign keys clearly.
(20 Marks)
3) a)What is meant by Normalization? Explain with suitable examples.
a) Consider the relation R = {A, B, C, D, E, F, G, H, I, J, K} and the functional dependencies
{A, B} {E, F, H}
{A} {D, J}
{B} {C, G}
{G} {I}
{K} {A}
Assume the keys of R to be A and B. Decompose R into 2NF, 3NF and BCNF. (20 Marks)
4) Consider the following tables and answer the questions given below.
EmployeeMaster
EmployeeNo – Primary Key
FName – Cannot contain null values
LName
Status
Salary – Always should be more than 1000
Designation
DeptNo–Foreign key from the fieldDepartmentNo of Department table
Department
DepartmentNo–Primary Key
DName
DLocation
Write SQL statements to:
a) Create the above two tables.
b) Insert a record to the Department table. Use your own data.
c) Display the first name and last names of all the employees, indescending order of
employee’ssalary.
d) Create a view to display the employee number, first name, last name and department name of all
the managers.
e) Update allemployees’ salaries with a 5% increment.
f) Display the average salaryof employees in each department.
g) Create a user to your database with the username ‘Amal’ and password as ‘ab123’
h) GrantSELECT and INSERTprivileges to the user Amal from the EmployeeMaster table.
(20 Marks)
Page 2 of 3
5) a) Write a transaction for the following scenario.
When a sale is made a new record will be written to the Sales Table and the quantity in hand in the
ItemMaster Table has to be updated.
Sales Table ItemMaster Table
ItemNo OrderDate QuantitySold ItemNo ItemName QuantityInHand
b) Write your own SQL Function to display the SubjectName when the SubjectCode is inserted.
SubjectCode SubjectName
S01 Intro
S02 QTC
S03 DBMS
S04 C Language
(10 Marks)
6)
a) Explain the difference between a stored procedure and a trigger.
b) Explain each line in the following trigger.
CREATE OR REPLACE TRIGGER pricecheck_tg
BEFORE UPDATE OF saleprice ON item
FOR EACH ROW
BEGIN
IF :NEW.saleprice < :OLD.saleprice*0.9 THEN
:NEW.saleprice := :old.saleprice;
END IF;
END;
c) Explain few examples where a trigger can be used in a database application.
(10 Marks)
Page 3 of 3