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

SQL Please help me in put in the correct SQL commands in the 6 blanks ______ bel

ID: 3591098 • Letter: S

Question

SQL Please help me in put in the correct SQL commands in the 6 blanks ______ below. Thank you in advance!

Fill in the blanks in the SQL statement below that will list the invoice number, vendor contact initials (first letter of first name and first letter of second name example: M.D.) and the invoice date for vendors that have not paid a payment on the invoice.

SELECT invoice_number, CONCAT( ___________ , ‘.’,  , ____________ ‘.’ )
AS initials, invoice_date
FROM vendor, vendor_contacts, invoices
WHERE invoices.vendor_id = vendors.vendor_id
AND vendors.contact_id = vendor_contacts. contact_id
AND payment_total = 0.0;

Fill in the blanks in the SQL statement below that will list the invoice number, vendor name and the invoice date for vendors that have not paid a payment on the invoice. Format the invoice date as DD-Mon-YYYY (example: 28-Mar-2017).

SELECT invoice_number, name, ____________  
FROM vendors, invoices
WHERE invoices.vendor_id = vendors. vendor_id
AND payment_total = 0.0;

Fill in the blanks in the SQL statement below that will list the invoice_id, invoice_total and the invoice_date for invoices with amounts over $1000. Format the invoice date as DD/MM/YYYY (example: 3/28/2017). Round invoice amount to one decimal place.

SELECT invoice_id, ___________, DATE_FORMAT(invoice_date, ___________ )
FROM invoices
WHERE invoice_total > 1000;

Fill in the blanks in the SQL statement below that will list the vendor name where the vendor’s address2 would be NULL.

SELECT name
FROM vendors
WHERE address2 ________________;

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

Fill in the blanks in the SQL statement below that will list the invoice number, vendor contact initials (first letter of first name and first letter of second name example: M.D.) and the invoice date for vendors that have not paid a payment on the invoice.

SELECT invoice_number, CONCAT(first_name,1 , ‘.’, last_name,1, ‘.’ )
AS initials, invoice_date
FROM vendor, vendor_contacts, invoices
WHERE invoices.vendor_id = vendors.vendor_id
AND vendors.contact_id = vendor_contacts. contact_id
AND payment_total = 0.0;

-----------------------------------------------------------------------------------------------------------------------------------------------------

Fill in the blanks in the SQL statement below that will list the invoice number, vendor name and the invoice date for vendors that have not paid a payment on the invoice. Format the invoice date as DD-Mon-YYYY (example: 28-Mar-2017).

SELECT invoice_number, name, format(invoice_due_date, 'DD-Mon-YYYY') FROM vendors, invoices
WHERE invoices.vendor_id = vendors. vendor_id
AND payment_total = 0.0;

--------------------------------------------------------------------------------------------------------------------------------------

Fill in the blanks in the SQL statement below that will list the invoice_id, invoice_total and the invoice_date for invoices with amounts over $1000. Format the invoice date as DD/MM/YYYY (example: 3/28/2017). Round invoice amount to one decimal place.

SELECT invoice_id, round(invoice_total,1), DATE_FORMAT(invoice_date, 'DD/MM/YYYY')
FROM invoices
WHERE invoice_total > 1000;

-------------------------------------------------------------------------------------------------------------------------------------------

Fill in the blanks in the SQL statement below that will list the vendor name where the vendor’s address2 would be NULL.

SELECT name
FROM vendors
WHERE address2 = 'NULL';