1.) Using the ch07_saleco database write a T-SQL query to display the customer c
ID: 3672920 • Letter: 1
Question
1.) Using the ch07_saleco database write a T-SQL query to display the customer code and customer last name from the customer table where a record is returned from the invoice table where the customer customer code equals the invoice customer code. (hint: exists)
2.) Using the ch07_saleco database write a T-SQL query to display the customer code, customer last name, and customer phone for phone numbers begin with the prefix 894.
3.) Using the ch07_saleco database write a T-SQL query to display the customer code, invoice number invoice date, and invoice subtotal from invoice conditioned on the invoice subtotal is greater than $100 and from only customer codes 10011 and 10012. (hint: in)
Relational Diagram Database name: Ch07 SaleCo LINE INV NUMBER -- INV-NUMBER LINE NUMBER CUS CODE P.DESCRIPT 5 CONTACT CUS AREACODE P.DISCOUNT 0 V.ORDER Table name: CUSTOMER Table name: VENDOR V STATE V ORDER 21226 SuperLoo, Inc.Flushing 5 0 24004BrackrnanBros. Browing Table name: INVOICE Table name: LINE P CODE LINE UNITS LINE PRICE Table name: PRODUCT 1QER31 Power painter, 15 psi., 3-nozzle 3-02P27.25-in. pwr.saw blade 3895 14.01L3 9.00-n. pwr. saw blade 1546-002 Hr.cloth,14-in,2x50 1558-G1 Hrd.cloth,1/2-in, 3x50 49922321QTY B3D igsaw, 12-in. blade 2 587 2238IOPD B3D cordless drill1/2-in 6.99 23109-HB Claw hammer 9.95 1499 PVC23DRT PVC pipe, 3.5-in, 8-t 09.92 23114-AA Sledge hammer, 12 54778-2T Rat-tail file, 18-in. fine 25699 89 WRE-Q Hicut chain saw,16 in SM-18277 125-in. metal screw, 25 01-Mar-08172 75 SW-23116 2.5-n. wd. screw, 50 WR3TT3 Steel matting,4x8x16". 5" mesh 17-Jan-08 587 24-Feb-08 237 100Explanation / Answer
1) SELECT CUS_CODE,CUS_LNAME FROM CUSTOMER INNER JOIN INVOICE WHERE CUS_CODE=CUS_CODE.
2) SELECT CUS_CODE,CUS_LNAME,CUS_PHONE FROM CUSTOMER WHERE CUS_PHONE LIKE '%894-%'
3)SELECT CUS_CODE,INV_NUMBER,INV_DATE,LINE_PRICE FROM INVOICE INNER JOIN LINE ON INV_NUMBER=INV_NUMBER WHERE LINE_PRICE>100 AND CUS_CODE=10011 OR CUS_CODE=10012
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.