0% found this document useful (0 votes)
45 views

CSIT2040 - Database Systems

The document contains details about the final exam for the Database Systems course at Sri Lanka Institute of Information Technology. The exam contains 4 questions assessing different database concepts. Question 1 involves converting an EER diagram to relational model and mapping an ISA hierarchy. Question 2 tests functional dependencies and normalization. Question 3 covers JDBC drivers, SQL statements, and backup strategies. Question 4 involves writing SQL queries on a fuel management database schema and creating a function and trigger.

Uploaded by

ms21900518
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
45 views

CSIT2040 - Database Systems

The document contains details about the final exam for the Database Systems course at Sri Lanka Institute of Information Technology. The exam contains 4 questions assessing different database concepts. Question 1 involves converting an EER diagram to relational model and mapping an ISA hierarchy. Question 2 tests functional dependencies and normalization. Question 3 covers JDBC drivers, SQL statements, and backup strategies. Question 4 involves writing SQL queries on a fuel management database schema and creating a function and trigger.

Uploaded by

ms21900518
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 5

/ 00003

Sri Lanka Institute of Information Technology

B.Sc. Honours Degree in Information Technology

Final Examination
Year 2, Semester 1 (2022)

CSIT2040 -Database Systems

Duration: 2 Hours

November 2022

Instructions to Candidates:

• This paper is preceded by 10 minutes reading period. The supervisor will


indicate when answering may commence.
• This paper has 4 questions.
• Answer all questions in the booklet given.
• The total marks for the paper is 100.
• This paper contains 5 pages, including the cover page.
• Electronic devices capable of storing and retrieving text, including
calculators and mobile phones are not allowed.
`.-\

oosee\

Question 1 (20 marks)

Consider the following EER Model.

a) Convert the following EER model into the relational model. Indicate the primary keys and the
foreign keys of the resulted relations clearly. (16 marks)
b) What is the best option for mapping the ISA hierarchy in the diagram? Justify your answer.
(4 marks)

NIC
00C;$3

Question 2 (15 marks)

Consider a relation R (A, 8, C, D, E, F) with the following set of functional dependencies over R:

F = {AB > C, E > F, D + EG, C + H}

a) Find all the keys in relation R using attribute closure method. (4 marks)

b) Is R in 3NF? Give reasons for your conclusion. (3 marks)

c) IS R in BCNF? IfR is not in BCNF, convert it to a set ofBCNF relations. (8 marks)

Question 3 (25 marks)

a) What is the purpose of JDBC Driver Manager in JDBc architecture? (2 marks)

b) Consider the following block of code written in Java Language. What is the type of statement in
which `s ' is an object of? How is it different from other types of statements? (2 marks)

do(
System. out . println ( "enter name : " ) ,.
String name=br . readLine ( ) ,.
System. out .println ( "enter salary: " ) ;
float salary=Float .parseFloat (br. readLine ( ) ) ;

s . setstring ( 1, name ) ,.
s . setFloat (2 , salary) ,.
int i=ps . executeupdate ( ) ;

c) Briefly explain the difference between full back ups and differential backups. (3 marks)

d) A database used to store information related to an airline reservation system is required to be


backed up every 1 2 hours. How would you propose to achieve this? (2 marks)

e) Consider the following requirements of a university which contains several programs having
modules related to database management systems.
A senior system administrator holds the responsibility of creating and maintaining databases
required for the modules. Under the senior system administrator a junior administrator carries
out the duties of creating logins and handling requests such as changing passwords. Module
leaders have all permissions within the database allocated to the module. Students on the other
\.

OOS03 \

hand are only capable of executing DDL or DML statements inside the database of the module.
They are not allowed to execute any procedures or triggers.

Write T-SQL statements to do the following:


Write a T-SQL to create a SQL server authenticated login to Chamara who is a junior
system administrator with the login name ` Chamara' (3 marks)
ProvidepermissionstoChamaratoperformthedutiesofcreatingandupdatingloginsusing
a user defined sever role (4 marks)
HHH Assuming that Salian is the module leader of Database Management Systems module for
which a database named DMS is created, provide necessary permission to him on the said
database assuming that he has a user name by `sahan.a'. (3 marks)
1V. Create a user defined role to provide permissions to the students following the Database
Management Systems to the database DMS. Add a student with user name DIT0101010 to
the above role (4 marks)
V. Suppose that the student with usemame DIT0101010 has completed the Database
Management Systems module and thus do not require to used the database anymore. Write
T-SQL statements to remove the permissions students had to the DMS database. (2 marks)

Question 4 (40 Marks)

Consider the following schema of a database designed to track fuel issuance by a fuel provider.
Fillingstation (licenseNo: int, location : varchar(50), provider: varchar(30))
Vehicle (vRegNo : char(6), ownerNIC: char(10), fuelType : char(15), vehicleType:
char ( 30 ) )
Owner (NIC: char(10), name : varchar(25), age : int, gender: char(1), phone:
char ( 10 ) )
Filledln (vRegNo: char(6), licenseNo: int, amount : int, filledDate: datetime)
Quota (vehicleType: varchar(30), quota: int)

The Fillingstation table consists of license number (/I.ce775eIVo), /occz/I.o# of filling stations and the
name of the provz.c7er such as `IOC' and `Cepetco' . Vehicle table consists of registration number of
the vehicle (vJzegIVo), NIC of the owner (ow#erjwc), fuel type of the vehicle such as `Petrol' and
`Diesel' "2zeJr){pe) , type of vehicle such as `car','van' and `motor cycle' (vefoz.c/er)pe).Owner table

consists ofJVIC, #cz77ce, age, ge7cc7cr and pfrone number of each vehicle owner. Filledln table consists
of the registration number of the vehicle which had fuel pumped (vjzegIVo), license number of the
filling station at which the fuel is pumped (/I.ce77seIVo), the cz7%o##/ of fuel pumped in liters and date
and time at which the fuel is pumped 0?/JeczDczJe). The Quota table consists of type of vehicle such
as `car' and `van'(vefrz.c/er}pe) and g24oro of fuel given for a`week with respect to each type.
/ iijiG`j;-i-jt`j

//
a) Write SQL queries to answer following questions.
i. Display the registration number and type of all vehicles which has pumped fuel in from
fllling stations located at `Kunmegala' on 20th July 2022 (4 marks)
ii. Find the registration number of vehicle and NIC of the car owners which has not pumped in
fuel in August 2022 (6 marks)
Note : MONTH and YEAR function returns the month number and year given a date in SQL
server
iii. Find the NIC and name of vehicle owners who had got more than 1001iters of `Diesel'
pumped in to vehicles he owns within any month ofa year. (7 marks)
Note : MONTH and YEAR function returns the mohih number and year given a date in SQL
server

b) Create a functiori which accept vehicle registration number and calculate the remaining fuel
amount from the quota available for the vehicle for the current week considering the type of
vehicle and available quote as specified in Quota table. (12 marks)
Note: T~SQL function DATEPART(week,<date>) returns week's number within the year Of the
specified date.

c) Create a trigger to prevent vehicles from pumping fuel than the remaining quota of fuel for the
vehicle. (11 marks)

Note: Use the function created in part b)

You might also like