A database query is a way to ask the database for specific information.


1. Collecting Specific Data

Example:

SELECT Product, Amount, SaleDate
FROM Sales
WHERE SaleDate BETWEEN '2025-08-01' AND '2025-08-31';


2. Summarizing Data

Example: Total sales per product

SELECT Product, SUM(Amount) AS TotalSales
FROM Sales
GROUP BY Product;