Question
6. 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
6. | 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? |
a) | (1,2,4) | b) | (1,3,2) | c) | (4,3,3) | d) | (2,1,3) | ||||||||
7. | The table Scores(Team, Day, Opponent, Runs) Contains the following 12 rows:
What is the result of the following query?
SELECT S1.Team, S2.Team FROM Scores S1, Scores S2 WHERE S1.Opponent = S2.Opponent AND S1.Team <> S2.Team Identify in the list below a tuple of the result. |
a) |
| ||||
b) |
| ||||
c) |
| ||||
d) |
| ||||
8. | 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:
What is the result of executing on this data the query:
SELECT Team FROM Scores WHERE RunsFor > RunsAgainst AND RunsFor <= RunsAgainst + 2 Identify in the list below, the team that appears in the output. |
a) | Bay Stars | ||
b) | Ham Fighters | ||
c) | Carp | ||
d) | Giants | ||
9. | Suppose relations R(A,B) and S(B,C,D) have the tuples shown below:
Compute the result of the join query:
SELECT A, R.B, S.B, C, D FROM R, S WHERE R.A < S.C AND R.B < S.D Then, identify one of the tuples in the result from the list below. |
a) | (5,6,4,6,8) | ||
b) | (3,4,5,7,9) | ||
c) | (1,2,2,6,8) | ||
d) | (5,6,4,6,9) | ||
10. | 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:
What is the result of executing on this data the query:
SELECT S1.Team, S2.Team FROM Scores S1, Scores S2 WHERE S1.Team < S2.Team AND (S1.RunsFor = S2.RunsFor OR S1.RunsAgainst = S2.RunsAgainst) Remember that when strings are compared, "<" means "precedes in alphabetical order. Identify, in the list below, a row of the result. |
a) |
| ||||
b) |
| ||||
c) |
| ||||
d) |
|
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started