Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

image text in transcribed

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#image text in transcribedS#(image text in transcribedP#= P'1'(SPJ))

g.) S INNER_JOINS.S# = SPJ.S# image text in transcribedS#(image text in transcribedP#= 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 ondon

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

Learning MySQL Get A Handle On Your Data

Authors: Seyed M M Tahaghoghi

1st Edition

0596529465, 9780596529468

More Books

Students also viewed these Databases questions

Question

u = 5 j , v = 6 i Find the angle between the vectors.

Answered: 1 week ago

Question

What is the difference between Needs and GAP Analyses?

Answered: 1 week ago

Question

What are ERP suites? Are HCMSs part of ERPs?

Answered: 1 week ago