wayground logo

Free Printable Worksheets

NEW

Font size

S
M
L
XL
Worksheets

DTBase

Total questions: 20

Worksheet time: 10mins

Name
Class
Date
1.

A UNION query is which of the following?

a)

Combines the output from two queries and must include the same number of columns

b)

Combines the output from multiple queries and must include the same number of columns

c)

Combines the output from multiple queries and does not have to include the same number of columns

d)

Combines the output from two queries and does not have to include the same number of columns

2.

In the given query which of the keywords has to be inserted? INSERT INTO employee ___ (1002, Joey, 2000);

a)

Value

b)

Field

c)

Relation

d)

Table

3.

Which of the following relations is in Third normal form (3NF)?

a)

R(ABCD) FD’s: AB -> C; BCD -> A; D -> A; B -> C

b)

R(ABCD) FD’s: C -> B; B -> A; AC -> D; AC -> B

c)

R(ABCD) FD’s: ACD -> B; AC -> D; D -> C; AC -> B

d)

R(ABCD) FD’s: AB -> C; ABD -> C; ABC -> D; AC -> D

4.

Which of the following is NOT true about SQL Subqueries?

a)

Subqueries are executed first.

b)

None of these.

c)

They are nested queries.

d)

Only one subquery can be nested.

5.

This graphic indicates:

a)

a student cannot own a car.

b)

That a student can own 0, 1 or many cars.

c)

A car can be owned by many students

d)

A student can own many cars and a car can be owned by many students.

6.

Which of the following statements is NOT true about subqueries?

a)

Subqueries may occur in other places than the WHERE clause.

b)

Subqueries can be added with an ORDER BY clause.

c)

Subqueries cannot be nested multiple times

d)

Subqueries can be used to compare an expression to the result of the query.

7.

Suppose relations R(A, B) and S(B, C, D) are as follows: Compute the full outer join on B, the left outer join on B, and the right outer join on B. In each case, R is the left operand and S is the right operand. Find the correct statement in the list below.

a)

The full outer join has 3 NULL’s

b)

The full outer join has 6 tuples

c)

The full outer join has 3 tuples

d)

The full outer join has 2 NULL’s

8.

In ERD, what is the meaning of the rounded arrow?

a)

One or many

b)

Many

c)

One and only one

d)

One or Zero

9.

Supposed we have a table staffs containing the first and last name of all staffs in USTH. Write a query to return find the official email of each person, given that the domain is @usth.edu.vn and the mail is of the following format: last_name.first_name@usth.edu.vn

a)

SELECT first_name, last_name, concat(last_name, ‘.’, first_name, ‘@usth.edu.vn’) AS Official_mail FROM Staffs

b)

SELECT first_name, last_name, concat(last_name, ‘.’, first_name) AS Official_mail FROM Staffs;

c)

All of these are correct

d)

SELECT first_name, last_name, distinct(first_name) AS Official_mail FROM Staffs;

10.

Supposed we have a table Employee that contains the id (emp_id), name(emp_name) and working experience (experience) of each employee in a company. Write a query to find the second employee in terms of experience in increasing order? (first being the one with max experience).

a)

SELECT emp_id, MAX(experience) AS second_max_exp FROM Employee WHERE experience < (SELECT MAX(experience) FROM Employee);

b)

All are correct

c)

SELECT emp_id, experience AS second_max_exp FROM Employee WHERE experience < (SELECT MAX(experience) FROM Employee);

d)

SELECT emp_id, experience AS second_max_exp FROM Employee WHERE experience > (SELECT MAX(experience) FROM Employee);

11.

Which of these queries will display the table given above?

a)

Select employee

b)

Select employee from name

c)

Select name from employee

d)

Select name

12.

Let R(ABCDEFGH) satisfy the following functional dependencies: A -> B, CH -> A, B -> E, BD -> C, EG -> H, DE -> F. Which of the following FD’s is also guaranteed to be satisfied by R?

a)

BCD -> FH

b)

ACG -> DH

c)

CGH -> BF

d)

ADG -> CH

13.

Consider the relation Courses(C, T, H, R, S, G), whose attributes may be thought of information as course, teacher, hour, room, student and grade. Let the set of FD’s for Courses be CàT, HR à C, HT à R, HS à R, and CS à G. Intuitively, the first says that a course has a unique teacher, and the second says that only one course can meet in a given room at a given hour. The third says that a teacher can be only one room at a given hour, and the fourth says that the same about students. The last says that students get only one grade in a course. Let’s choose the key of Courses?

a)

HT

b)

HR

c)

HST

d)

C

e)

HS

14.

Suppose relation R(A, B, C) has the tuples: Compute the projection PI (C,B)(R) and identify one of its tuples from the list below.

a)

(5,3)

b)

(2,5)

c)

(6,5)

d)

(1,2)

15.

Which keyword allows us to find the unique values in the database?

a)

FIND

b)

DIFF

c)

DISTINCT

d)

UNIQUE

16.

Which of the following is used to modify the data stored in the database?

a)

UPDATE

b)

SELECT

c)

INSERT INTO

d)

LIMIT

17.

Which of the following is not an aggregate function in SQL?

a)

COUNT

b)

AVG

c)

SUM

d)

FIND

18.

Data becomes ____ when it is presented in a format that people can understand and use.

a)

Information

b)

Processed

c)

Presentation

d)

Graphs

19.

Consider the following data STUDENTS (student_code, first_name, last_name, email, phone_no, date_of_birth, honours_subject, percentage_of_marks); Which of the following query would display the names of all the students whose honours subject is English and percentage of marks more than 80, or honours subject is Spanish and percentage of marks more than 80?

a)

SELECT first_name, last_name FROM STUDENTS WHERE honours_subject = “English” OR honours_subject = “Spanish” AND percentage_or_marks > 80;

b)

SELECT first_name, last_name FROM STUDENTS WHERE (honours_subject = “English” OR honours_subject = “Spanish” AND percentage_or_marks > 80);

c)

SELECT first_name, last_name FROM STUDENTS WHERE (honours_subject = “English” OR honours_subject = “Spanish”) AND percentage_or_marks > 80;

d)

SELECT first_name, last_name FROM STUDENTS WHERE (honours_subject = “English”) OR (honours_subject = “Spanish”) AND percentage_or_marks > 80;

20.

A weak entity type

a)

Both answers are correct

b)

Must have total participation in an identifying relationship

c)

Does not have a key attribute(s)

d)

None of the above