Raf Vergauwen 6fbee37b5b fix v3 | 2 years ago | |
---|---|---|
README.md | 2 years ago | |
bulb.png | 2 years ago | |
question-mark.png | 2 years ago |
Write a SELECT statement that returns these four columns:
Use these aliases for the tables: v for Vendors and i for Invoices.
Return one row for each invoice with a non-zero balance. This should return 11 rows.
Sort the result set by vendor_name in ascending order.
Write a SELECT statement that returns these three columns:
Return one row for each vendor. This should return 122 rows.
Sort the result set by account_description and then by vendor_name.
Write a SELECT statement that returns these five columns:
Use aliases for the tables. This should return 118 rows.
Sort the final result set by vendor_name, invoice_date, invoice_number, and invoice_sequence.
Write a SELECT statement that returns three columns:
Return one row for each vendor whose contact has the same last name as another vendor’s contact. This should return 2 rows.
Hint: Use a self-join to check that the vendor_id columns aren’t equal but the vendor_contact_last_name columns are equal.
Sort the result set by vendor_contact_last_name.
Write a SELECT statement that returns these three columns:
Return one row for each account number that has never been used. This should return 54 rows.
Hint: Use an outer join and only return rows where the invoiceid column contains a null value.
Remove the invoice_id column from the SELECT clause.
Sort the final result set by the account_number column.
Use the UNION operator to generate a result set consisting of two columns from the Vendors table:
If the vendor is in California, the vendor_state value should be “CA”; otherwise, the vendor_state value should be “Outside CA.”
Sort the final result set by vendor_name.