Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

/* *** SQL-QUERY-CH07-01 *** */ SELECT C.CustomerID, C.CustomerName, P.ProductNumber, P.ProductName, SUM(PS.Quantity) AS TotalQuantity FROM CUSTOMER C, PRODUCT_SALES PS, PRODUCT P WHERE C.CustomerID = PS.CustomerID AND

image text in transcribed

image text in transcribed

/* *** SQL-QUERY-CH07-01 *** */ SELECT C.CustomerID, C.CustomerName, P.ProductNumber, P.ProductName, SUM(PS.Quantity) AS TotalQuantity FROM CUSTOMER C, PRODUCT_SALES PS, PRODUCT P WHERE C.CustomerID = PS.CustomerID AND P.ProductNumber = PS.ProductNumber GROUP BY C.CustomerID, C.CustomerName, P.ProductNumber, P.ProductName ORDER BY C.CustomerID, P.ProductNumber; 

1. Write an SQL query similar to SQL-QUERY-CH07-01 (shown above as an example, has nothing to do with the questions) that uses the hours worked per day as the measure. Include employee ids, names, experience levels , property ids and property names.

2. Write the SQL view equivalent of the SQL query you wrote to answer 1.

3. Create the SQL view you wrote to answer 2 in your GG-DW database.

USE 9Q dw: - use cxcal =DATEVNLUE ("D5-05-2019") etc to compuls theee 5/2019=0 43690 NSERT INTO TIMEUNE WLUES. INSERT INTO EMPLOYEE WLUES| 1. 'Gmith', 'Sam', Mastar? INGERT INTO EMPLOYEE WLUES| 2. Evaraton', 'John', 'Benior']; INSERT INTO EMPLOYEE WLUES' 3. Mumal, Dale', 'Junior', INSERT INTO EMPLOYEE WLUES| 4. Muphy, 'Jerry, Mastor', INSERT INTO EMPLOYEE WLUES| 5. Fontaine', 'Jasan', 'Soniory INSERT INTO PRCPERTY VLLUES| 1, Eastiake Bulding', 'Soatte', 'WQ', "ga119': INSERT INTO PRICFERTY VLLUES| 2. Em St Apts', Lynwood, wN', '9e2233); INSERT INTO PROPERTY VOLUES! 3. 'Jeftarson Hir, Bellevud', 'WW', sedoot? INSERT INTO PRDPERTY VOLUES| 4. Lake Vow Apts', Redmond', 'Wa', geos2? INGERT INTO PRDPERTY VLLUES! 5. Kodak Hoights Apts', Rodmond, Wa, 9eociz); NSERT INTO PRCPERTY WLUES! INSERT INTO PRCFERTY VOLUES| 7.'Douglas House', Bellovud', 'WN', '9e007']; PRCFERTY VOLUES! B. 'Gamuds Houad', 'Fiodmond, 'WQ', seosz'? B. 'Samuds Houed', 'Redmond, 'WA', 'Sa052'] Pww* SERVCE - 55201942980 ofo, soe above - additional made-up data folowa INSERT INTO SERVCE HCURS WRUESI43E21, 1, 1, 4.501: - 6.5 NSERT INTO SERVCE HCURS WLUES(43E24,3, 1, 4.501 - 6.8 NSERT INTO SERVCE HCURS WLUES(43E24, 2, 3, 2.75: - 6-8 INSERT INTO SERVCE HCURS WRUES(43626, 6,5,2.500610 NSERT INTO SERVCE HCURS WRLUES(43E28,5. 5, 7.50I: - 6-12 NSERT INTO SERVCE HCURS WRLUES(43631,8, 4, 2.75: - 6-15 RSERT INTO SERVCE HCURS WRUES(43635,4, 2, 3.00: - 6-19 NSERT INTO SERVCE HCURS WRLES(43635, 7, 4, 2.501 - 6-19 NSERT INTO SERVCE HCURS WRLUESI43E31,1, 3, 4.501: - 7.5 INSERT INTO SERVCE HCURS WRUESI43E54,3, 5, 4.501 - 7.8 NSERT INTO SERVCE HCURS NRLUESI43ES4 2, 4, 2.75: - 78 INSERT INTO SERVICE HCURS WRLUES(43ES6, 6,5,2.501:710 INSERT INTO SERVCE HCURS WRLUES(43ESB, 5,3 , 7.SOI: - 7-12 NSEERT INTO SERVCE HCURS WRLUES(43661,8, 1, 2.75: - 7-15 NSERT INTO SERVICE HCURS WRLUES(43665,4, 2, 3.001: - 7-19 NSERT INTO SERVICE HCURS WRLUES(436E5, 7,1,250]7-19

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

Exploring The Hospitality Industry

Authors: John R Walker

4th Edition

0134744934, 9780134744933

More Books

Students also viewed these General Management questions