Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Question 1 ( 1 point ) Here are three relations, R ( A , B ) , S ( C , D ) , and

Question 1(1 point)
Here are three relations, R(A,B), S(C,D), and T(E,F). Their current values are:
R S T
A B
01
10
11
C D
01
10
11
E F
01
10
11
Compute the result of the query:
SELECT A, F, SUM(C), SUM(D)
FROM R, S, T
WHERE B = C AND D = E
GROUP BY A, F
HAVING COUNT(*)>1
Identify, in the list below, the row that appears in the result.
Question 1 options:
(1,1,2,2)
(1,1,2,1)
(1,1,1,1)
(1,1,1,2)
Question 2(1 point)
The table
Scores(Team, Day, Opponent, Runs)
Gives the scores in the Japanese Baseball League for two consecutive days. The Opponent is NULL if the Team did not play on that day. The number of Runs is given as NULL if either the team did not play, or will play on that day but the game is not yet concluded. The data in this table is as follows:
Team Day Opponent Runs
Dragons Sunday Swallows 4
Tigers Sunday Bay Stars 9
Carp Sunday NULL NULL
Swallows Sunday Dragons 7
Bay Stars Sunday Tigers 2
Giants Sunday NULL NULL
Dragons Monday Carp NULL
Tigers Monday NULL NULL
Carp Monday Dragons NULL
Swallows Monday Giants 0
Bay Stars Monday NULL NULL
Giants Monday Swallows 5
Consider the following three queries, which differ only in the team mentioned in the WHERE clause.
1) SELECT COUNT(*), COUNT(Runs)
FROM Scores
WHERE Team = 'Tigers'
2) SELECT COUNT(*), COUNT(Runs)
FROM Scores
WHERE Team = 'Carp'
3) SELECT COUNT(*), COUNT(Runs)
FROM Scores
WHERE Team = 'Swallows'
Then, identify in the list below the result of one of these queries.
Question 2 options:
12 NULL
122
21
121
Question 3(1 point)
The latest scores from the Japanese Baseball League are in the table with schema
Scores(Team, Opponent, RunsFor, RunsAgainst)
The data in this table is as follows:
Team Opponent RunsFor RunsAgainst
Dragons Tigers 53
Carp Swallows 46
Bay Stars Giants 21
Marines Hawks 53
Ham Fighters Buffaloes 16
Lions Golden Eagles 812
Tigers Dragons 35
Swallows Carp 64
Giants Bay Stars 12
Hawks Marines 35
Buffaloes Ham Fighters 61
Golden Eagles Lions 128
What is the result of executing on this data the query:
SELECT Team, Opponent
FROM Scores
WHERE Team LIKE '%%' OR
Opponent LIKE '_i%'
Identify, in the list below, a row of the result.
Question 3 options:
Hawks Marines
Golden Eagles Lions
Buffaloes Ham Fighters
Giants Bay Stars
Question 4(1 point)
The table Arc(x,y) currently has the following tuples (note there are duplicates): (1,2),(1,2),(2,3),(3,4),(3,4),(4,1),(4,1),(4,1),(4,2). Compute the result of the query:
SELECT a1.x, a2.y, COUNT(*)
FROM Arc a1, Arc a2
WHERE a1.y = a2.x
GROUP BY a1.x, a2.y;
Which of the following tuples is in the result?
Question 4 options:
(2,4,6)
(1,3,4)
(3,1,4)
(1,3,2)
Question 5(1 point)
Here are three relations, R(a,b), S(a,b), and T(a,b). Their current values are:
R S T
a b
00
01
10
11
a b
00
01
10
11
a b
00
01
10
11
Compute the result of the query:
SELECT R.a, R.b, S.b, T.b
FROM R, S, T
WHERE R.b = S.a AND S.b <> T.b
Identify, in the list below, the true statement about whether or not a tuple appears in the output, and how many times it appears.
Question 5 options:
(0,1,1,0) appears twice.
(0,0,1,0) appears once.
(1,1,1,0) appears once.
(0,0,0,1) appears once.
Question 6(1 point)
Suppose we have a relation with schema
R(A, B, C, D, E)
If we issue a query of the form
SELECT ???
FROM R
WHERE ...
GROUP BY C, D
What terms can appear in the SELECT list (represented by ??? in the above query)? Identify, in the list below, the term that CAN NOT appear.
Question 6 options:
MAX(B)
SUM(E)
A
COUNT(*)
Question 7(1 point)
The latest scores from the Japanese Baseball League are in the table with schema
Scores(Team, Opponent, RunsFor, RunsAgainst)
The data in this table is as follows:
Team Opponent RunsFor RunsAgainst
Dragons Tigers 53
Carp Swallows 46
Bay Stars Giants 21
Marines Hawks 53
Ham Fighters Buffaloes 16
Lions Golden Eagles 812
Tigers Dragons 35
Swallows Carp 64
Giants Bay Stars 12
Hawks Marines 35
Buffaloes Ham Fighters 61
Golden Eagles Lions 128
What is the result of executing on this data the query:
SELECT Team AS Winner, RunsFor + RunsAgainst AS Runs
FROM Scores
WHERE RunsFor > RunsAgainst
Identify in the list below, a value and the name of a column in which it appears.
Question 7 options:
"Dragons" appears in column Winner.
5 appears in column RunsFor.
6 appears in column Runs.
8 appears in column RunsAgainst.
Question 8(1 point)
The latest scores from the Japanese Baseball League are in the t

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Theory Icdt 99 7th International Conference Jerusalem Israel January 10 12 1999 Proceedings Lncs 1540

Authors: Catriel Beeri ,Peter Buneman

1st Edition

3540654526, 978-3540654520

More Books

Students also viewed these Databases questions