Here is a Quick Recap of SQL Concepts for Data Analyst Interviews:
FROM clause: Identifies the tables from which data will be retrieved.
WHERE clause: Filters rows that meet certain conditions, narrowing down the dataset.
GROUP BY clause: Organizes identical values into groups, often used with aggregate functions.
HAVING clause: Applies filters on groups created by the GROUP BY clause.
SELECT clause: Specifies which columns or expressions to display in the query results.
WINDOW functions: Perform row-wise calculations without collapsing the data, like ROW_NUMBER
, RANK
, LAG
.
AGGREGATE functions: Includes SUM
, COUNT
, AVG
, and others, used for summarizing data.
UNION / UNION ALL: Merges results from multiple queries into a single result set. UNION
removes duplicates, while UNION ALL
keeps them.
ORDER BY clause: Arranges the result set in ascending or descending order based on one or more columns.
LIMIT / OFFSET (or FETCH / OFFSET): Limits the number of rows returned and specifies the starting row for pagination.