You are on page 1of 1

Deleting Rows

—- Delete data
DELETE FROM invoices
WHERE client_id = (
SELECT client_id
FROM clients
WHERE name = 'Myworks')

Aggregate Functions
—- MAX, MIN, AVG, SUM and COUNT
SELECT
MAX(invoice_total) AS highest,

MIN(invoice_total) AS lowest,

AVG(invoice_total) AS average,

SUM(invoice_total) AS total,

COUNT(invoice_total) AS number_of_invoices,

COUNT(payment_date) AS count_of_payments,

COUNT(DISTINCT client_id) AS total_records

FROM invoices

WHERE invoice_date > '2019-07-01'

You might also like