Professional Documents
Culture Documents
2019 Marking Scheme
2019 Marking Scheme
Table: Departments
DEPT_ID DEPT_NAME LOCATION GRADE
25 MARKETING Colombo 1
30 ACCOUNT Colombo 2
35 ADMIN Kandy 3
40 IT Kurunegala 3
45 SALES Colombo 1
c) All employees from the Employees table who works in a department which has more
Grade than 3 (That is grade 1 or grade 2)
(5 marks)
SELECT * FROM Employees WHERE DEPT_ID IN(SELECT DEPT_ID IN
Departments WHERE GRADE < 3)
(ii) Compare and contrast Database tables and Database views. Point out at least 3 facts
(5 marks)
Database tables Database views
Table is a preliminary A view is a virtual table
storage for storing data and whose contents are defined by
information a query
Tables takes significant Views takes very little space
space to store, since they to store, since they do not
store actual data. store actual data.
A view can incorporate Several tables are used to
several tables into one store linked data and
virtual table records.
(10 marks)
CREATE PROCEDURE AddNewRecords()
BEGIN
INSERT INTO Employee VALUES (515, “Nishanthi”, “Gunathilaka”,
“CLERK”, 40,000, 35);
DELETE FROM Department WHERE DEPT_NAME = “IT”;
END
5) (i) State 3 types of database connectivity methods and mention the specific application for each
(5 marks)
ADO- Used to access to a relational or non-relational database
from both Microsoft and other database providers.
ODBC- ODBC is used to make an independent access of database
systems and operating systems.
JDBC- Used to connect Java applications to external, relational
database management systems (RDBMS).
(iii) Assuming that you are the “Root” (or Administrator) of a relevant DBMS, write SQL
statements to,
a) Create a user called “Amaya” and password “abcd” (5 marks)
b) Grant Select privilege only to the user “Amaya” for Employee and Department tables
(5 marks)
GRANT SELECT ON *. Employee, *.Department TO 'Amaya'@'localhost';
c) Revoke Update and Delete privileges from the user “Assistant” for Employee and
Department tables (5 marks)
(Assume that the user “Assistant” and relevant privileges already exist)