First page Back Continue Last page Image
How the Window Changes the Output
SELECT vendor_id, invoice_date, invoice_total,
SUM(invoice_total) OVER() AS total_invoices,
SUM(invoice_total) OVER(PARTITION BY vendor_id)
AS vendor_total
FROM invoices
WHERE invoice_total > 5000
Here we have 2 Windows, one with no Partition and one with a Partition by vendor_id
Notice that the total_invoices column totals all invoices because the Partition was everything
Notice that the vendor_total column totals based on the Partition field : vendor_id