logo

Show Sums of Line Totals for Each Invoice

6 Pages479 Words147 Views
   

Added on  2020-04-07

Show Sums of Line Totals for Each Invoice

   Added on 2020-04-07

ShareRelated Documents
Question1: Show sums of line totals for each invoice.Query: SELECT INV_NUMBER, SUM(LINE_TOTAL) AS LINE_TOTAL_SUM FROM LINE GROUP BY INV_NUMBER;Output:Question2: Locate the record in the vendor table that does not have a value for the attribute V_STATEQuery: SELECT * FROM VENDOR WHERE V_STATE IS NULL;Output:
Show Sums of Line Totals for Each Invoice_1
Question 3: Find the customers whose balance is greater than 200 but less than 300.Query: SELECT * FROM CUSTOMER WHERE CUS_BALANCE>200 AND CUS_BALANCE<300;Output:Question 4: Using natural join and having, list the customers whose invoice total is greater than 200Query: SELECT CUS_CODE, CUS_LNAME, CUS_FNAME, CUS_INITIAL FROM CUSTOMER NATURAL JOIN INVOICE GROUP BY CUS_CODE HAVING SUM(INV_TOTAL)>200;Output:
Show Sums of Line Totals for Each Invoice_2
Question5: Show the names of the customers for whom we have invoices.Query: SELECT DISTINCT CUS_CODE, CUS_LNAME, CUS_FNAME, CUS_INITIAL FROM CUSTOMER NATURAL JOIN INVOICE;Output:Question 6: Using natural join and having, list the customers whose invoice total is greater than the average Query: SELECT CUS_CODE, CUS_LNAME, CUS_FNAME, CUS_INITIAL FROM CUSTOMER NATURAL JOIN INVOICE GROUP BY CUS_CODE HAVING SUM(INV_TOTAL)> (SELECT AVG(INV_TOTAL) FROMINVOICE);Output:
Show Sums of Line Totals for Each Invoice_3

End of preview

Want to access all the pages? Upload your documents or become a member.

Related Documents
Show sums of line totals for each invoice.. Query:.
|6
|460
|212

Structured Query Language (SQL) Assignment
|4
|451
|190

Database Assignment Module
|13
|375
|111

Desklib - Online Library for Study Material with Solved Assignments, Essays, Dissertation etc
|6
|703
|93

Database Module- Assignment
|13
|272
|56

Database Module Assignment
|13
|366
|40