If R is a relation instance that has 5 tuples in it, S is a relation instance that has 8 tuples in it, and T is a relation
instance that has 3 tuples in it, then how many tuples are there in the Cartesian Product ( R x S ) x T? ANS
120
If R(A,B) is a relation where A's domain is (a1, a2, a3, a4) and B's domain is (b1, b2, b3), what the maximum
number of different tuples that can be in an instance of R, assuming that A can also be NULL, but B can't be
NULL? ANS 15
If a tuple appears 20 times in the answer to Q1, and that same tuple also appears 6 times in the answer to Q2,
then:
How many times would that tuple appear in Q1 EXCEPT Q2?
How many times would that tuple appear in Q1 EXCEPT ALL Q2? ANS 0
14
TRUE, FALSE, or UNKNOWN.
NULL = 18 ? ANS UNKNOWN
TRUE, FALSE, or UNKNOWN.
NULL IS NOT NULL ? ANS FALSE
TRUE, FALSE, or UNKNOWN.
NULL > 20 OR 18 <= 20 ? ANS TRUE
What does the following code do?
, SELECT DISTINCT Team
FROM Scores
WHERE Team LIKE '%n%' ANS Selects distinct teams from the table scores where the team has the letter
'n' in it.
What does the following code do?
SELECT Opponent, Day
FROM Scores
WHERE Runs >= 6
ORDER BY Day, Opponent DESC; ANS Selects the Opponent with the Day from the table Scores where
the runs were greater than 6, with it ordered by Day from A-Z.
What does the following code do?
SELECT S1.Team, S1.Day
FROM Scores S1
WHERE S1.Runs <= ALL
(
SELECT S2.Runs
FROM Scores S2
WHERE S1.Day = S2.Day
) ANS Select teams with the days where they had the least amount of runs from their day
SELECT Team, MIN(Runs) AS MinRuns, MAX(Runs) AS MaxRuns
FROM Scores
WHERE Opponent IN ('Swallows', 'Bay Stars', 'Giants')
GROUP BY Team; ANS Select the teams with their minimum and maximum runs vs those three opponents
TRUE or FALSE