You are on page 1of 5

ICT502 DATABASE ENGINEERING TEST 25 NOVEMBER 2020

STUDENT NAME: _______________________________________________________


STUDENT ID: ____________________________

INSTRUCTIONS:
Please answer ALL questions on separate papers (your own Answer Sheets).
Submit all answer through Edmodo

TOTAL MARK: 60 MARKS


QUESTION 1 (10 MARKS)

1) In Oracle, the ___________ function compares expr1 and expr2. If expr1 and expr2 are
equal, this function returns NULL.
A. DECODE
B. COALESCE
C. NULLIF
D. NVL2

2) What is data integrity?


A. It is the data contained in database that is non-redundant.
B. It is the data contained in database that is accurate and consistent.
C. It is the data contained in database that is secured.
D. It is the data contained in database that is shared.

3) You are the DBA of CEKAL Corp. You need to retrieve the employee names and salaries
from the employment tables, and to make the results assorted by salary, NOT in
ascending order. Just in case, if two names match for a salary are found, the two names
should be shown in alphabetical order. How do you do this?
A. ORDER BY sal NON-ASC, ename;
B. ORDER BY ename, sal;
C. ORDER BY sal DESC, ename;
D. ORDERED BY sal,ename;

4) The standard EMP table we have worked with so far in the book contains 14 records
corresponding to employees of the corporation. One of those records has a NULL value
stored in the MGR column. You issue the following command on that table: SELECT
COUNT(MGR) FROM EMP; Which of the following choices identifies the result Oracle will
return?
A. 13
B. 11
C. 12
D. 14
ICT502 DATABASE ENGINEERING TEST 25 NOVEMBER 2020

5) Which single-row function would you use to return a specific portion of a character
string?
A. INSTR
B. SUBSTR
C. LPAD
D. LEAST

6) What is the error in the following code?


SELECT STUDENT.STUDENT_ID, COURSE_CODE
FROM STUDENT S
WHERE COURSE_CODE = ‘CS230’ ;
A. If a table alias name is defined, you cannot use the table name to qualify a
column.
B. When tables are not joined, a table alias name cannot be used in the query.
C. When a table alias name is defined, it must be used to quantify all the column
names.
D. In the SELECT clause, you cannot have one column qualified and another column
not qualified. Either all columns are qualified, or no columns are qualified.

7) What SQL statement would return the following about clerks in each department?

DEPTNO MIN(SAL) MAX(SAL)


10 1300 3000
20 800 1100

A. Select deptno, MIN(sal), MAX(sal)


WHERE job = 'CLERK'
GROUP BY deptno;
B. SELECT deptno, MIN(sal), MAX(sal)
GROUP BY deptno;
C. Select deptno, MIN(sal), MAX(sal)
FROM emp
WHERE job = 'CLERK'
D. SELECT deptno, MIN(sal), MAX(sal)
FROM emp
WHERE job = 'CLERK'
GROUP BY deptno;

8) You are evaluating a procedure that has the function MOD (100,10). What would be the
result?
A. 10000
B. 10
C. 100
D. 0
ICT502 DATABASE ENGINEERING TEST 25 NOVEMBER 2020

9) Evaluate this command:


SELECT group_id, isotope, AVG(atomic_weight)
FROM chart_n
WHERE AVG(atomic_weight) > 89.00
GROUP BY group_id, isotope
ORDER BY group_id, isotope;

Which clause will cause an error?


A. SELECT group_id, isotope, AVG(atomic_weight)
B. WHERE AVG(atomic_weight) > 89.00
C. GROUP BY group_id, isotope
D. ORDER BY group_id, isotope;

10) Inspect the following SQL statement:


SELECT Farm_Name, Cow_Id,
COUNT(Carton) As Number_of_Cartons
FROM Cow_Milk
GROUP BY Cow_Id;

Which of the following choices contains the line with the error?
A. Select Farm_Name, Cow_Id,
B. COUNT(Carton) As Number_Of_Cartons
C. Group By Cow_Id;
D. There are no errors in the statement.

QUESTION 2 (10 MARKS)

a) On regular basis, Mariah can finish the staff monthly claims analysis in less than an hour.
But ever since the database is shared for the whole company using the DBMS approach,
the time taken to do the analysis has increased to 3 hours. Explain the situation that is
happening to Mariah.
(2 marks)
b) Sales Information System and Human Resources System are two systems that are mainly
used by Woods Company to manage their business. The databases of the systems are not
linked together because of the departmental ownership. Explain TWO (2) problems that
the company might encounter if the current database approach is still being practiced.
(4 marks)
c) In data modeling, sometimes it necessary to show an entity with a relationship to itself
but in different roles. Name that type of relationship and illustrate it with ONE (1)
example.
(4 marks)
ICT502 DATABASE ENGINEERING TEST 25 NOVEMBER 2020

QUESTION 3 (21 MARKS)

The relational schema below shows the database for LetReadBook Library system.
CUSTOMER (custid, custname, custemail, custphone, custbirthdate, registerdate)
STAFF (staffid, staffname, staffemail, salary, staffphone, staffbirthdate, hiredate,
position)
BOOK (isbn, booktitle, quantity, bookpublisher, bookauthor)
BORROW (borrowid, borrowdate, custid, staffid)
BORROW_BOOK (borrowid, isbn)

There are a lot of customers who will borrow books from the library every day. The weekly
borrowing limit is only 5 books per customer. The borrowing of the book is handled by the staff
at the counter.
Answer the following questions by using SQL and Relational Algebra.

a) Display all the staffs’ details that were hired in 2018.


(4 marks)
b) Show the title of the book along with how many times it has been borrowed. If the book
has never been borrowed, display ‘Not yet borrowed’.
(7 marks)
c) Find the total quantity of book borrowed based on each publisher.
(6 marks)
d) By using SQL, show number of customers with age from 19 – 25 years old just like in the
display below.
19-25 years old
100
(4 marks)

QUESTION 4 (19 MARKS)

a) Database is a shared collection of logically related data. Explain the meaning of logically
related data.
(2 marks)

b) In methodology of database design, explain the importance of reviewing back the data
model with users as one of the steps in conceptual database design.
(2 marks)

c) Read the following case study.

TV99 is the new free channel television intending to develop a new system to store
information on the production of TV programs. As a new database designer of TV99, you
are required to design the database structure according to the following business rules
and specifications:
ICT502 DATABASE ENGINEERING TEST 25 NOVEMBER 2020

• TV99 has many producers to produce TV programs. However, each TV program can
only be produced by one producer.
• TV programs can be documentary, news, or dramas. Documentary programs contain
the title of the documentary, scope, and duration. While, in news program there are
language of news, presenters, duration and time slot. Dramas programs have the
script writer, genre, number of episode and duration. Each TV program is identified by
a program code.
• One producer can be assisted by many production crews. Each production crew can
work with many producers. The crew id, name, department, and contact number are
recorded. While, for producer, an id, name, and contact numbers will be stored.
• For each production work, the schedule of production like date and day of production,
location, hours of work and overtime claim are recorded.

Draw the Entity Relationship Diagram for the above case study. Be sure to indicate the
multiplicity of each relationship. Show the attributes that are associated with each entity,
marking the primary and the foreign keys.
(15 marks)

-END OF TEST QUESTIONS-

You might also like