compsci-notes-spring-2024/notes/database-prog/sql-scripts/2024-01-31.sql
2024-01-31 20:20:15 -06:00

19 lines
No EOL
733 B
SQL

-- #### Start of class stuff ####
-- Get the InvoiceId, InvoiceTotal, and InvoiceDueDate for all invoices for vendor 110
SELECT InvoiceId, InvoiceTotal, InvoiceDueDate
FROM Invoices
WHERE VendorID = 110
-- Get the latest 10 invoices for vendor 123: InvoiceId, InvoiceDueDate, InvoiceTotal
SELECT TOP 10 InvoiceId, InvoiceTotal, InvoiceDueDate
FROM Invoices
WHERE VendorID = 123
ORDER BY InvoiceDueDate DESC
-- Get the InvoiceId, VendorId, InvoiceDueDate, and InvoiceTotal for all invoices due between 1/1/2020 and 1/31/2020
SELECT InvoiceId, VendorId, InvoiceDueDate, InvoiceTotal
FROM Invoices
WHERE InvoiceDueDate BETWEEN '1/1/2020' AND '1/31/2020'
-- ######################################################################## --