🍕SQL
Basics
-- Selecting columns to display in the result
SELECT Product, SUM(Amount) AS TotalSales
-- Specifying the table to retrieve data from
FROM Sales
-- Filtering data based on conditions
WHERE Region = 'East' AND YEAR(Date) = 2023
-- Grouping the result by the 'Product' column
GROUP BY Product
-- Filtering the grouped results based on aggregate conditions
HAVING SUM(Amount) > 10000
-- Ordering the final result by total sales in descending order
ORDER BY TotalSales DESC;SQL Case
Create table
Insert data into a table
Delete table
Alter table
Last updated