ACTUAL Exam Questions and CORRECT
Answers
R1, R2 and R3 are relation instances.If R1 has 5 tuples in it, R2 has 4 tuples in it, and R3 has 6
tuples in it.How many tuples are there in the result of the following SQL query?
SELECT * FROM R1, R2, R3; - CORRECT ANSWER - 4 x 5 x 6 = 120 tuples
Let R(A, B, C, D) be a relation, where (A, B, C) is the primary key for R, and attribute D can be
NULL. Assume that attribute A's domain has 6 different values, B's domain has 2 different
values, C's domain has 3 different values, and D's domain has 5 different values.
What is the maximum number of tuples that can be in an instance of R? - CORRECT
ANSWER - 6 x 3 x 2 = 36
D's values don't affect the max number of tuples since it is not part of the primary key and can be
NULL.
NULL, UNKNOWN and the Empty Set have different meanings in SQL.
Give an example of an expression that could have each of these values. - CORRECT
ANSWER - NULL:
SELECT name, age FROM employees WHERE age IS NULL;
UNKNOWN:
SELECT * FROM employees WHERE age = NULL;
Empty Set:
SELECT * FROM employees WHERE age < 18;