Are these correct SQL statements or am I off in somethings? Thanks CREATE VIEW I
ID: 3561136 • Letter: A
Question
Are these correct SQL statements or am I off in somethings? Thanks
CREATE VIEW InitialService AS
SELECT MarinaSlip_SlipID, ServiceCategory_CategoryNumber, ServiceCategory_CategoryDescription, ServiceRequest_EstHours, ServiceRequest_Spenthours
FROM [MarinaSlip, ServiceCategory, ServiceRequest]
WHERE SpentHours=0;
CREATE VIEW LargeSlip AS
SELECT MarinaNum, SlipNum, Rentalfee, BoatName, OwnerNum
FROM [MarinaSlip]
WHERE Length=4;
SELECT MarinaSlip.[MarinaNum], MarinaSlip.[SlipNum], MarinaSlip.[RentalFee], MarinaSlip.[BoatName], MarinaSlip.[OwnerNum], MarinaSlip.[Length]
FROM MarinaSlip;
Explanation / Answer
See the correct answer below, please rate me the best
CREATE VIEW InitialService AS
SELECT MarinaSlip as SlipID, ServiceCategory as CategoryNumber, ServiceCategory as CategoryDescription, ServiceRequest as EstHours, ServiceRequest as Spenthours
FROM MarinaSlip MS, ServiceCategory SC, ServiceRequest SR
WHERE MS.slipid=sc.slipid
and SC.request_id=SR.request_id (you have to write some join like this with primary key and foreign key)
and SpentHours=0;
CREATE VIEW LargeSlip AS
SELECT MarinaNum, SlipNum, Rentalfee, BoatName, OwnerNum
FROM MarinaSlip
WHERE Length=4; (This is correct)
SELECT MarinaNum, SlipNum, RentalFee, BoatName, OwnerNum, Length
FROM MarinaSlip ;(Same table , no need to mentioned the table names prefixed, but what you have writter also right, table name prefix we use in joins mosly becuase to tell the column from which table it has to pick the data)
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.