Thanks to visit codestin.com
Credit goes to www.scribd.com

0% found this document useful (0 votes)
3 views4 pages

DBMS

The document outlines an examination paper for various diplomas in computer studies, focusing on database management systems. It includes questions on database advantages, ER diagrams, SQL queries, normalization, and stored procedures. The exam consists of five questions that require detailed answers and practical applications of database concepts.

Uploaded by

chanuwanni
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views4 pages

DBMS

The document outlines an examination paper for various diplomas in computer studies, focusing on database management systems. It includes questions on database advantages, ER diagrams, SQL queries, normalization, and stored procedures. The exam consists of five questions that require detailed answers and practical applications of database concepts.

Uploaded by

chanuwanni
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

NATIONAL INSTITUTE OF BUSINESS MANAGEMENT

Diploma in Computer System Design 18.1F –DCSD-1-3-04


Diploma in Software Engineering 18.1F –DSE-1-3-04
Diploma in Computer Networks 18.1F –DCN-1-3-04
Database Management Systems
28th June 2018, 13.00p.m. – 16.00 p.m
This paper contains 05 questions
Answer All questions.
Time: THREE hours.

Question One
i. Databases are essential components in software development process where the organisational
data are stored in a well-organised manner. Write down advantages of the databases over
traditional flat files. (3 marks)

ii. Draw a relational database table called “Student”. Indicate (Colum headings / Attributes),
(Rows/ Tuples/ Records), Fields, Primary key. (3 marks)

iii. What is a Database Management System ? Give examples for 3 DBMS’s. (3 marks)

iv. What is a composite key ? Write down an example for composite key. (3 marks)

v. What is a foreign key. Explain how the foreign key helps you to create a link between two
tables. (3 marks)

Question Two
Scenario:
“Weekday Special” is a restaurant which is opened on week days. It has variety of items for the
customers to enjoy Sri Lankan foods. “Weekday Special” has an automated system to maintain
their restaurant details and transactions.

They have a file called “Menu” which maintains their menu details having menuCode and
menuName. To record food item details in each menu, a file called “FoodItem” is maintained
which has itemCode, itemName, menuCode and price.

Customers can reserve tables at the restaurant and those details are maintained in “Reservation
File”. It contains the details reservationCode, customerName, address, contactNo, advancePay.
When the dining is finished, customer pays the bill to the waiter. Waiter details are maintained in
the “Waiter” file which contains waiterId, waiterName. Customer receipt details are maintained in

Page 1 of 4
the “Receipt” file which contains the receiptNo, menuCode, foodItem, paymentType and the
amount. Customer can make payment in two ways either by “cash” or “credit card”. Each payment
type is maintained in two separate files having paymentCode and amount.

a. Draw an Enhanced ER diagram for the given scenario. Note: Other than the entities in the
given scenario, you could include additional entities if required.
b. Map the Enhanced ER in to the relational schema (You should specify Table Name,
Primary key, Foreign key/s of each table clearly. (20 marks)

Question Three
Consider the following relation and answer the questions below.
The below table contains patient details who were admitted to a hospital. Due to viral attack of
fever and cough, some of them have admitted more than once.

Patient

PatientID PatientName Disease Date Doctor DoctorName WardNo NoOfts


Admitted ID Patients
P01 Browns Fever 01.02.2018 D01 Nicolas W01 30
Cough 02.04.2018 D02 Steve W02 20
P02 Anne Vomiting 02.02.2018 D01 Nicolas W01 30
Fever 08.03.2018 D03 Mary W01 30
P03 Neel Cough 02.05.2018 D03 Mary W01 30
Fever 03.05.2018 D04 Elvis W03 40
P04 Allen Arthritis 06.05.2018 D05 Peter W04 30
P05 Victor Fever 08.04.2018 D03 Mary W02 20
Cough 04.05.2018 D06 Stella W05 50

i. The above is an un-normalized relation. Why do you say that it is “un-normalized”?


(02 marks)
ii. Normalize the above relation 1st, 2nd and 3rd Normal forms. (10 marks)
iii. What is an “atomic value” ? (02 marks)
iv. Explain “Transitive Dependency”. (04 marks)
v. What are the possible type of anomalies found in an un-normalized relation? (02 marks)

Page 2 of 4
Question Four

The below questions are on SQL queries.

1. What is SQL? (2 marks)

2. Consider the following relations Student, Lecturer, University and City:

Student
Stno stname stream uniCode Lec_code
St001 Nimal Biology UC 100
St002 Kamal Maths UJ 101
St003 Saman Commerce UJ 103

Lecturer
Lec_code Lecturer Name specialization uniCode
100 Perera Chemistry UC
101 Victor Physics UR
102 Gihan Economics UJ
103 Sanath Finance UJ

University

uniCode uniName city


UC University of Colombo Colombo
UR University of Ruhuna Matara
UJ University of Jayawardanapura Jayawardanapura

City
city province
Colombo Western
Matara Southern
Jayawardanapura Westerm
Peradeniya Central

Write down an SQL queries to do the following:


1. Display details of all the students who are doing biology (2 mark)
2. Display details of the students who’s lecturer name is starting with “C”. (2 mark)
3. Display name of the lecturers who are specialized in Chemistry or Physics (2 mark)
4. Display the number of students in the table (2 mark)
5. Display number of students in each stream (Biology, Maths, Commerce) (2 mark)

Page 3 of 4
6. Display “University Name” of the lecturer’s who are teaching “Maths” stream students
(2 marks)
7. Display uniCode and Province of each University. (2 marks)
8. Display Name of the University of the lecturers whose name is starting with
V and who are specialized in “Physics”. (2 marks)
9. Display student name and stream of the students whose lecturers studied at University of
Colombo. (2 marks)
10. Display University name of the lecturers who are teaching for the
Students having the name starting with “S”. (2 marks)
11. Write SQL query to create a Database called University. (2 mark)
12. Write SQL query to create a table called Student. Use your own data types and field sizes
(2 marks)
13. Update the stream of student St002 to Computer Science (2 marks)

Question Five

The following questions would be based on “Stored Procedures” and “Triggers”.

1. Consider the stored procedure given below :


CREATE Procedure addStudent
(@stno char(4),
@stna varchar(50),
@address varchar(200),
@tel char(10),
@mark int,
@grade nchar(2));

WITH

Insert into stud values (stno, stna, address, tel, mark, grade)

i. The above SP has some errors. Correct the mistakes and write down the
correct SP in answer sheets. (4 marks)
ii. Mark parameters in the above stored procedure. (2 marks)
iii. What is the purpose of these parameters. (2 marks)
2. Write a stored procedure which updates student mark in the student table. (3 marks)
3. Why do we fire triggers on Insert, Update, Delete functions in databases? (3 marks)
4. Write a trigger for INSERT operation in “emp” table.
(You could define your own field names for the table.) (3 marks)
5. Briefly explain how to improve security of a database. (3 marks)

Page 4 of 4

You might also like