Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Upload a single sql file that contains all solutions prefixed with comments for the following exercises. Exercises 1. Write a SEL. ECT statement that returns

image text in transcribed
image text in transcribed
Upload a single sql file that contains all solutions prefixed with comments for the following exercises. Exercises 1. Write a SEL. ECT statement that returns all columns from the Vendoes table inner-joined with all columns from the Invoiees table. This should return 114 rows. Hint: You can use an ateriak f") he seicct the columes from botit tables. 2. Write a SEL.ECT statement that returns these four columms: vendor_name The vendor_name columa from the Vendor table invoice_number The invice_number column fran the lavoices table involee_date The involice_date column from the imoices table balance_due The iavoice fotal column minss the payment_fotal and credit_cotal colamns from the Invoices table Use these aliase for the tables: v for Vendons and i for Imoices. Return one row for each invice with a non-tero halance. This wheuld return II rows. Sort the result set by vendot_name in aseending order. 3. Write a SEL.ECT statement that returns theve three columns: vendor_name. The vendor_aame columa from the Vendors takle default_account The defaak_, account_mumber colume from the Vendors tahle desceiptice The acoount_description colume from the General_Ledger_Accounts takle Return one row for each vendor. Thisshould teturn 122 rows. Sort the result set by account_description and then by vendor_name. 4. Write a SFI.FCT statentent that returns these five columins: vendor_name The vendor_name column from the Vendors table invoice_date The invoice_date celuma from the Invoices table invoice_number The invoice_number column from the Imvices table I_sequence The imvoice_sequence colunn from the Invoice_Line_liems table Ii_amount The line_irem_amount column from the Invoice_Line_Items rable Use aliases for the tablex. This should return 118 rows. Sort the final result set by vendor_name, invoice_date, invoice_number, and imvoice_sequence. 5. Write a SEL.ECT statement that retums three colamns: vendor_id The vendor_id column from the Vendors table vendor_name The vendor_name column from the Vendors table coust_name A concatenation of the vendvr_contact_first_mame and vendor_coriact_last_name columns with a space between Return one row for each vendor whose contact has the same last name as another vendor's contact. This should return 2 rowx. Hint: Use a selfyoin to check that the rendor_lif columnr aren't eyaal but the veidor_contact_las__name columns are equal. Sort the result set by vendot_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 imoice_id column contains a mull 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: vendor_name and vendor_state. 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

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

Beginning Databases With PostgreSQL From Novice To Professional

Authors: Richard Stones, Neil Matthew

2nd Edition

1590594789, 978-1590594780

More Books

Students also viewed these Databases questions

Question

The company openly shares plans and information with employees.

Answered: 1 week ago