Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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:

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

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)
Swallows Swallows
b)
Giants Giants
c)
Carp Swallows
d)
Tigers Tigers
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:

Team Opponent RunsFor RunsAgainst
Dragons Tigers 5 3
Carp Swallows 4 6
Bay Stars Giants 2 1
Marines Hawks 5 3
Ham Fighters Buffaloes 1 6
Lions Golden Eagles 8 12
Tigers Dragons 3 5
Swallows Carp 6 4
Giants Bay Stars 1 2
Hawks Marines 3 5
Buffaloes Ham Fighters 6 1
Golden Eagles Lions 12 8

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:

R =
A B
1 2
3 4
5 6
S =
B C D
2 4 6
4 6 8
4 7 9

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:

Team Opponent RunsFor RunsAgainst
Dragons Tigers 5 3
Carp Swallows 4 6
Bay Stars Giants 2 1
Marines Hawks 5 3
Ham Fighters Buffaloes 1 6
Lions Golden Eagles 8 12
Tigers Dragons 3 5
Swallows Carp 6 4
Giants Bay Stars 1 2
Hawks Marines 3 5
Buffaloes Ham Fighters 6 1
Golden Eagles Lions 12 8

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)
Ham Fighters Giants
b)
Tigers Hawks
c)
Carp Ham Fighters
d)
Buffaloes Bay Stars

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 And Application Bio Science And Bio Technology International Conferences DTA And BSBT 2011 Held As Part Of The Future Generation In Computer And Information Science 258

Authors: Tai-hoon Kim ,Hojjat Adeli ,Alfredo Cuzzocrea ,Tughrul Arslan ,Yanchun Zhang ,Jianhua Ma ,Kyo-il Chung ,Siti Mariyam ,Xiaofeng Song

2011th Edition

ISBN: 3642271561, 978-3642271564

More Books

Students also viewed these Databases questions