Question
1.) Please check each of the following SQL statements or Relational Algebra expressions. If it has a syntax error, please point it out and JUSTIFY
1.) Please check each of the following SQL statements or Relational Algebra expressions. If it has a syntax error, please point it out and JUSTIFY YOUR ANSWER. If the query has no syntax errors, please give the result of the query based on the database state given above.
a.) SELECT S#, P#, SUM(Qty)
FROM SPJ;
b.) SELECT S#, SUM(Qty)
FROM SPJ
GROUP BY S#
WHERE Qty > 300;
c.) SELECT S#
FROM SPJ
HAVING COUNT(*) > 2;
d.) SELECT DISTINCT S#
FROM SPJ
WHERE Qty > ALL (SELECT Qty FROM SPJ WHERE S# = 'S4');
e.) SELECT S#
FROM SPJ
WHERE P#='P1'
ORDER BY S#
UNION
SELECT S#
FROM SPJ
WHERE P#='P2';
ORDER BY
f.) S OUTER JOINS.S# = SPJ.S#S#(P#= P'1'(SPJ))
g.) S INNER_JOINS.S# = SPJ.S# S#(P#= P'1'(SPJ))
h.) SELECT S#, Sname
FROM S
MINUS
SELECT S#
FROM SPJ
i.) SELECT S#
FROM S
GROUP BY Sname
schema and a snapshot of SUPPLIER-PART PROJECT database is given below. Table S, P and J represent Supplier, Part, and Project, respectively. Table SPJ contains the shipment information such that a supplier shipped a quantity of a part to a project. S, P# and J# in table SPJ are foreign keys. 5. The Schema S | S# | Snamc | Status | City P | P# | Pname | Color | Weight | City Ja Citv Values: ,SPJ S# P# J# Qty. sl | PI | .11 | 200 700 3 100 2 200 3 J3200 S2 P3 500 3 600 52 P3 JG400 s# sname Status City SSmit S2 Joncs 20 aris Si 30 aris SAdams30 5 S2 Athens Pname Color Weight City P1 ut 12 0n atis reen Serew Serew CaBlue S2 P5 2 100 200 S3 P 200 tle ondon 53 12 l'aris S4 S4 0g 7300 J# Jname City orter 2Display Rom 14 0 S P00 S5 P57100 aris thens 2 200 P100 3200 S P 800 London JG 7 Tape EDS | Oslo ondonStep 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