For the following Relational Algebra / SQL statements, specify the output of each query. (do not explain how each query will be executed, but specify the output to be obtained when the query is executed). (c) R1: ACTORS WHERE YearOfBirth < 1940 OR Gender = 'female' R2(SSNo, FName, LName): R1 [ SSNo, FName, LName ] R3: R2 NATURAL-JOIN ACTEDIN OVER SSNo C: R3 [ LName, Character ] (d) SELECT A1.FName, A1.LName, A1.YearOfBirth FROM ACTORS A1, ACTORS A2 WHERE A1.YearOfBirth = A2.YearOfBirth AND A1.SSNo != A2.SSNo (e) R1: ACTEDIN [ FilmNo, SSNo ] R2: FILMS WHERE FilmTitle = 'Unforgiven' [ FilmNo ] R3: ACTEDIN NATURAL-JOIN R2 OVER FilmNo [ SSNo ] R4: ACTORS NATURAL-JOIN R3 OVER SSNo [ SSNo, FName, LName ] R5: ( R1.SSNo ÷ R4.SSNo ) [ FilmNo ] C: ACTEDIN NATURAL-JOIN R5 OVER FilmNo [ FilmTitle ] (f) SELECT A.FName, A.LName, COUNT(*) FROM ACTORS A, ACTEDIN AI WHERE A.SSNo = AI.SSNo GROUP BY A.SSNo, A.FName, A.LName HAVING count(*) > 2 OR count(*) = 0
For the following Relational Algebra / SQL statements, specify the output of each query. (do not explain how each query will be executed, but specify the output to be obtained when the query is executed).
(c) R1: ACTORS WHERE YearOfBirth < 1940 OR Gender = 'female'
R2(SSNo, FName, LName): R1 [ SSNo, FName, LName ]
R3: R2 NATURAL-JOIN ACTEDIN OVER SSNo
C: R3 [ LName, Character ]
(d) SELECT A1.FName, A1.LName, A1.YearOfBirth
FROM ACTORS A1, ACTORS A2
WHERE A1.YearOfBirth = A2.YearOfBirth AND
A1.SSNo != A2.SSNo
(e) R1: ACTEDIN [ FilmNo, SSNo ]
R2: FILMS WHERE FilmTitle = 'Unforgiven' [ FilmNo ]
R3: ACTEDIN NATURAL-JOIN R2 OVER FilmNo [ SSNo ]
R4: ACTORS NATURAL-JOIN R3 OVER SSNo [ SSNo, FName, LName ]
R5: ( R1.SSNo ÷ R4.SSNo ) [ FilmNo ]
C: ACTEDIN NATURAL-JOIN R5 OVER FilmNo [ FilmTitle ]
(f) SELECT A.FName, A.LName, COUNT(*)
FROM ACTORS A, ACTEDIN
WHERE A.SSNo = AI.SSNo
GROUP BY A.SSNo, A.FName, A.LName
HAVING count(*) > 2 OR count(*) = 0
Trending now
This is a popular solution!
Step by step
Solved in 2 steps