1/28
Looks like no tags are added yet.
Name | Mastery | Learn | Test | Matching | Spaced | Call with Kai | Chat |
|---|
No analytics yet
Send a link to your students to track their progress
SQL
Structured Query Language; used to retrieve and work with data in databases.
SELECT
Specifies which columns you want to see.
FROM
Specifies which table you are getting data from.
WHERE
Filters individual rows based on a condition.
GROUP BY
Groups rows that have the same value, often used with aggregate functions.
HAVING
Filters groups after GROUP BY; commonly used with AVG, SUM, COUNT, MAX, or MIN.
ORDER BY
Sorts the results.
ASC
Sorts from lowest to highest or A to Z.
DESC
Sorts from highest to lowest or Z to A.
LIMIT
Restricts the number of rows returned.
AVG()
Calculates the average of a column.
SUM()
Adds up the values in a column.
COUNT()
Counts rows or values.
MAX()
Finds the largest/highest value.
MIN()
Finds the smallest/lowest value.
Single quotes
Used around text values and usually date values in SQL.
Text example
'Finance' — text values go inside single quotes.
Date format
'YYYY-MM-DD', such as '2026-10-01'.
WHERE vs HAVING
WHERE filters individual rows; HAVING filters groups/aggregates.
Highest
Usually means ORDER BY column DESC.
Lowest
Usually means ORDER BY column ASC.
Top 3
Usually means ORDER BY ... DESC LIMIT 3.
Bottom 3
Usually means ORDER BY ... ASC LIMIT 3.
"for each department"
Usually means GROUP BY department.
"average salary"
Use AVG(salary).
"total salary"
Use SUM(salary).
"number of employees"
Use COUNT(*).
"highest salary"
Use MAX(salary) or ORDER BY salary DESC depending on what the question asks.
"lowest salary"
Use MIN(salary) or ORDER BY salary ASC depending on what the question asks.