0% found this document useful (0 votes)
20 views1 page

W05 Assignment

Assignment for BYU CIT111 Week 5
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
20 views1 page

W05 Assignment

Assignment for BYU CIT111 Week 5
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 1

SELECT *

FROM vendors AS v INNER JOIN invoices AS i


ON i.vendor_id = v.vendor_id

SELECT *
FROM vendors v INNER JOIN invoices i
ON i.vendor_id = v.vendor_id

SELECT vendor_name, invoice_number, invoice_date, invoice_total-(payment_total +


credit_total) AS balance_due
FROM vendors v JOIN invoices i
ON i.vendor_id=v.vendor_id
WHERE invoice_total-(payment_total + credit_total) > 0
ORDER BY vendor_name ASC

SELECT vendor_name, default_account_number AS default_account, account_description


AS description
FROM vendors
INNER JOIN general_ledger_accounts
ON vendors.default_account_number = general_ledger_accounts.account_number
ORDER BY account_description, vendor_name

SELECT vendor_name, invoice_date, invoice_number, invoice_sequence AS li_sequence,


line_item_amount AS li_amount
FROM vendors v
INNER JOIN invoices i
ON v.vendor_id = i.vendor_id
INNER JOIN invoice_line_items ili
ON i.invoice_id = ili.invoice_id
ORDER BY vendor_name, invoice_date, invoice_number, invoice_Sequence

SELECT v1.vendor_id, v1.vendor_name,CONCAT(v1.vendor_contact_first_name, ' ',


v1.vendor_contact_last_name) AS contact_name
FROM vendors v1
INNER JOIN vendors v2
ON v1.vendor_id <> v2.vendor_id AND v1.vendor_contact_last_name =
v2.vendor_contact_last_name

SELECT gl.account_number, account_description


FROM General_Ledger_Accounts gl LEFT JOIN Invoice_Line_Items il
ON gl.account_number = il.account_number
WHERE il.account_number IS NULL
ORDER BY gl.account_number

SELECT vendor_name, vendor_state


FROM vendors
WHERE vendor_state = 'CA'
UNION
SELECT vendor_name, 'Outside CA'
FROM vendors
WHERE vendor_state <> 'CA'
ORDER BY vendor_name;

You might also like