Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

SQL Please help me by filling in the 7 blanks _________ with the correct SQL sta

ID: 3591119 • Letter: S

Question

SQL Please help me by filling in the 7 blanks _________ with the correct SQL statements. Thank you in advance!

Fill in the blanks in the SQL statement below that will create a view named summary which lists the vendor name along with the number of invoices for that vendor for all vendors.

CREATE VIEW summary ___________
SELECT name, ______________
FROM invoices , _____________
WHERE invoice.invoice_id = ______________.invoice_id ;

Fill in the blanks in the SQL statement below that will an index named date on the invoice_date field in the invoices table.

CREATE ____________ ____________ ON ______________ (invoice_date);

Accounts Payable Database Listing Description of tables in the AP database Table: general_ledger_accounts general_ledger_accounts(account_number, description) Table: terms terms(terms_id, description, due_days) Table: vendor contacts vendor_contacts(contact_id, last_name, first_name) Table: vendor vendor(vendor_id, name, address1, address2, city, state, zip, phone, contact id, default_terms_id, default_account_number) Table: invoices invoices(vendor_id, number, invoice_date, invoice_total, payment_total, credit_total, terms_id, invoice_due_date, payment_date) Table: invoice_line_items invoice_line_items(invoice_id, sequence, a ccount number, amount, descriptiou

Explanation / Answer

The SQL statement below creates a view named 'summary' which list the vendor name along with the number of invoices for that particular vendor.

CREATE VIEW summary AS

SELECT name, COUNT(invoice_id)

FROM invoices, vendor

WHERE invoices.vendor_id_id = vendor.vendor_id

GROUP BY name;

The SQL statement below creates an Index named 'date' on the 'invoice_date' column of relation 'invoices'

CREATE INDEX date ON invoices (invoice_date);