-
SELECT and FROM: This is the “heart” of any SQL query - SELECT columns FROM table.
-
WHERE: This acts as a filter and allows you to select only relevant rows based on conditions.
-
GROUP BY: This helps you aggregate the data by grouping columns.
-
AVG/SUM/MAX/MIN: These are aggregate functions that help you summarise the data.
-
COUNT and DISTINCT: Count helps you find the number of entries and Distinct helps you find unique entries.
-
CASE WHEN: This is a very useful way to create a new derived field or perform complex aggregate operations.
-
JOIN: Join helps you combine data from different tables using join conditions. Please get familiar with inner and left/right/full outer joins.
-
UNION: Union and Union All help you to combine data from multiple tables with similar structure.
-
WINDOW FUNCTION: Allow you to perform calculations across a set of rows.
-
CTE and SUBQUERY: They help you create more complex queries by combining smaller queries.
Tekraj15/Sql-and-MySql-CheatSheet
SQL and MySql CheatSheet with Examples for Interviews Preparation as well as Developers