wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

CPO Lesson 1.4 IE

Total questions: 24

Worksheet time: 15mins

Name
Class
Date
1.

A (natural) join is equivalent to a product and a select.

a)

True

b)

False

2.

Let be a relation containing n tuples, and S be a relation containing m tuples.

How many tuples will the cross product of R and S (RxS) contain?

a)

n+m

b)

n\m

c)

n*m

d)

n^m

e)

m^n

3.

To be union compatible, two relations must:

a)

Have the same attribute names

b)

Have the same domains for their attributes

c)

Like the same kind of food

d)

Have the same number of attributes

4.

A DB contains the following relations:
Employee(e_id, e_first_name, e_last_name, e_salary, e_birth_date)

Contact(c_id, e_id, c_first_name, c_last_name, c_birth_date) (e_id references the e_id of the employee they work with)

Match desired information (i.e. target content for the result relation) and the relational operations to use.

All information about contacts and the employee they work with

a)

Product

b)

Natural Join

c)

Projection

d)

Selection

5.

A DB contains the following relations:
Employee(e_id, e_first_name, e_last_name, e_salary, e_birth_date)

Contact(c_id, e_id, c_first_name, c_last_name, c_birth_date) (e_id references the e_id of the employee they work with)

Match desired information (i.e. target content for the result relation) and the relational operations to use.

First names of all employees

a)

Product

b)

Natural Join

c)

Projection

d)

Selection

6.

A DB contains the following relations:
Employee(e_id, e_first_name, e_last_name, e_salary, e_birth_date)

Contact(c_id, e_id, c_first_name, c_last_name, c_birth_date) (e_id references the e_id of the employee they work with)

Match desired information (i.e. target content for the result relation) and the relational operations to use.

All employee-contact combinations

a)

Product

b)

Natural Join

c)

Projection

d)

Selection

7.

Based on the figure above, identify the number of tuples that will be returned by the following relational algebra query : σ \sigma\ Type = 'Saving' (Account)

a)

2

b)

3

c)

6

d)

0

8.

Choose the CORRECT symbol of SELECT in the Relational Algebra

a)

x

b)

π\pi

c)

\cap

d)

σ\sigma

9.

Identify the CORRECT output for table (Student Difference Lecturer) or (Student - Lecturer) in table above

a)
b)
c)
d)
10.

Write the CORRECT relational algebra expression based on the figure above

a)

π\pi managerID, managerName ( σ\sigma workExperience = 5) (MANAGER)

b)

σ\sigma managerID, managerName ( π\pi workExperience = 5) (MANAGER)

c)

π\pi managerID, managerName ( σ\sigma workExperience > 5) (MANAGER)

d)

σ\sigma managerID, managerName ( π\pi workExperience > 5) (MANAGER)

11.

Write the relational algebra to list the student's number and student's name whose age is 20 years old or state in Terengganu.

a)

π\pi StudentID, Name ( σ\sigma Age=20 AND State = "Terengganu" (STUDENT)

b)

π\pi StudentID, Name ( σ\sigma Age=20 OR State = "Terengganu" (STUDENT)

c)

σ\sigma StudentID, Name ( π\pi Age=20 AND State = "Terengganu" (STUDENT)

d)

σ\sigma StudentID, Name ( π\pi Age=20 OR State = "Terengganu" (STUDENT)

12.

Based on the table, identify the output produced when σ Salary > 3000 ˅ City = ‘Batu Pahat’ (WORKER).

a)

b)

c)

d)

13.

Which of the following is used to denote the selection operation in relational algebra?

a)

Pi (Greek)

b)

Sigma (Greek)

c)

Lambda (Greek)

d)

Omega (Greek)

14.

The ___________ operation, denoted by −, allows us to find tuples that are in one relation but are not in another.

a)

Union

b)

Set-difference

c)

Difference

d)

Intersection

15.

The minimal set of super key is called

a)

Primary key

b)

Secondary key

c)

Candidate key

d)

Foreign key

16.

In the relational model, relationships between relations or tables are created by using:

a)

composite keys

b)

determinants

c)

candidate keys

d)

foreign keys

17.
What is SQL?
a)
Structured Query Language
b)
Suitable Query Language
c)
Sustainable Question Language
d)
Suitable Question Language
18.
Example of an SQL Command?
a)
REMOVE
b)
SELECT
c)
BIN
d)
NUMBER
19.
How many records are in this database?
a)
8
b)
5
c)
10
d)
12
20.
What is the primary key in this database?
a)
Emp_Id
b)
Last Name
c)
Gender
d)
Title
21.

Which would show all fields from the Pupils table?

a)

SELECT * FROM Pupils

b)

SELECT Name, Form FROM Pupils

c)

SELECT * FROM *

d)

SELECT * FROM Forms

22.

Which would find pupils with "er" anywhere in their name?

a)

SELECT * FROM Pupils Where Name = "%er"

b)

SELECT * FROM Pupils Where Name = "$er$"

c)

SELECT * FROM Pupils Where Name = "%er%"

d)

SELECT * FROM Pupils Where Name = "er%"

23.

Return all dramas made after 2004.

a)

SELECT * FROM movies WHERE genre = 'drama';

b)

SELECT * FROM movies WHERE genre = 'drama' AND year > 2004;

c)

SELECT * FROM movies WHERE genre = "drama' AND year < 2004;

d)

SELECT * FROM movies WHERE imdb_rating = 7 AND LIMIT = 7

24.

Write a code for the following: Return all romances that have an imdb_rating over 6.

a)

SELECT * FROM movies WHERE genre = ‘romance’ AND imdb_rating > 6;

b)

SELECT * FROM movies WHERE genre = ‘romance’ AND imdb_rating < 6;

c)

SELECT imdb_rating, name FROM movie WHERE genre = ‘romance’ AND imdb_rating > 6;

d)

SELECT * FROM movies WHERE genre = romance and imdb_rating < 6;