Professional Documents
Culture Documents
IT - SQL - Trial Exam
IT - SQL - Trial Exam
a) To remove a table from a database, you should use the DROP statement
d) Aggegate functions, like COUNT, have to be used together with a GROUP BY statement.
e) The referential integrity states that a foreign key should always refer to an existing primary
key
f) If a subselect returns NULL(s) in the output set, you have to use IN as operator before the
subselect in the WHERE statement.
h) The SQL standard for INNER JOIN states that the JOIN condition should be in the FROM
statement.
i) Suppose that A and B are mathematical sets, then |A X B| = |A| . |B|, where . is the
multiplication operator, and X the Cartesian product operator.
j) If ‘name’ is a column of a table, then ‘name = NULL’ is not a valid expression in a WHERE
statement.
Page 1 of 6
SQL – Trial exam
𝐴 = {1, 2, 3, 4, 5, 6} 𝐵 = {0, 3}
𝐶 = {𝑎, {𝑏, 𝑐}, {𝑎, 𝑑, 𝑒}} 𝐷 = {𝑝, 𝑞}
Determine for each of the following statements if this is TRUE or FALSE.
a) A ⊂ B
b) | C | = 5
c) {0} ∈ B
d) |A x D| = 8
e) {(0, q)} ∈ B x D
Page 2 of 6
SQL – Trial exam
Use for this question the HoF database shown in the appendix
Clearly indicate the result of the following queries (show column names, values and order):
a) SELECT gamecode
FROM games
ORDER BY year;
Page 3 of 6
SQL – Trial exam
Write the query that will show the requested information, and will match the shown results.
a) Show the names of the players that do not have any scores
b) Show from the players with a known birth year and who have scored, the name, gamecode
and age.
c) Show the name, gamecode and the name of the console for games that are played standard
on a console.
d) Show all unique codes of games, for which a player from England or Russia has scored.
e) Show for all games that do not have their origin in the USA, the gamecode and consolecodes.
Sort the result on game, and then on consolecode.
Use for this question the HoF database shown in the appendix
Indicate exactly what the result will be of the following queries. If the query will not work, indicate
why not, if it does work indicate everything that might change.
a) UPDATE consoles
SET consolecode ='PS4'
WHERE consolecode = 'PS3';
c) UPDATE consoles
SET consolecode ='N3DS2'
WHERE consolecode = 'N3DS';
d) UPDATE players
SET name = 'G-FAILES'
WHERE playercode = 'GF';
Page 4 of 6
SQL – Trial exam
Page 5 of 6
SQL – Trial exam
Page 6 of 6