logo

Show sums of line totals for each invoice.. Query:.

6 Pages460 Words212 Views
   

Added on  2020-04-07

Show sums of line totals for each invoice.. Query:.

   Added on 2020-04-07

ShareRelated Documents
1) Show sums of line totals for each invoice.Query:SELECT inv_number, SUM(line_total) FROM line GROUP BY inv_number;Output:2) 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.. Query:._1
3) Find the customers whose balance is greater than 200 but less than 300.Query:SELECT * FROM customer WHERE cus_balance BETWEEN (200+1) AND (300-1);Output:4) Using natural join and having, list the customers whose invoice total is greater than 200Query:SELECT customer.cus_code, cus_lname, cus_fname, cus_initial FROM customer NATURAL JOIN invoice GROUP BY customer.cus_code HAVING SUM(inv_total)>200;Output:
Show sums of line totals for each invoice.. Query:._2
5) Show the names of the customers for whom we have invoices.Query:SELECT cus_code, cus_lname, cus_fname, cus_initial FROM customer WHERE cus_code IN (SELECT cus_code FROM invoice);Output:6) Using natural join and having, list the customers whose invoice total is greater than the average Query:SELECT customer.cus_code, cus_lname, cus_fname, cus_initial FROM customer NATURAL JOIN invoice GROUP BY customer.cus_code HAVING SUM(inv_total)>( select avg(inv_total) from invoice);Output:
Show sums of line totals for each invoice.. Query:._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
|6
|479
|147

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

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

Database Assignment Module
|13
|375
|111

Database Module- Assignment
|13
|272
|56

Database Module Assignment
|13
|366
|40