How to Master SQL Queries, Joins and Aggregates with 74 Flashcards
Master SQL with 74 flashcards: WHERE and NULL, INNER/LEFT/FULL/CROSS joins, COUNT vs SUM, GROUP BY vs HAVING, subqueries, UNION and DDL. Deck HP2801 on Flip It.

Studying. But it's also a video game. 🎮
Flashcards, quizzes and games that make you actually remember.
Posted by
Related reading
Database Normalization in German: 32 Flashcards from 1NF to BCNF and 6NF
Learn database normalization in German: 32 flashcards on anomalies, keys and 1NF to 6NF, with IHK exam terms like Einfügeanomalie and two cards to rewrite.
Database Normalization in Spanish: 32 Flashcards from 1FN to FNBC and 6FN
Study database normalization in Spanish: 32 flashcards on anomalies, keys and 1FN to 6FN, with tips on Spanish exam terms and the one card to rewrite.
Learn Database Normalization in French: 32 Flashcards from 1NF to 6NF
French edition of Flip It's normalization deck: anomalies, keys, 1NF to 6NF, Merise vocabulary for 2NF and 3NF, and the one card you should rewrite before revising.
Most people who "know SQL" can write a SELECT with a WHERE. The gap opens when a query needs a LEFT JOIN instead of an INNER JOIN, when WHERE refuses an aggregate and you have to reach for HAVING, or when = NULL silently returns nothing. The SQL: Queries, Joins & Aggregates deck (code HP2801 on Flip It) packs those exact traps into 74 flashcards, moving from the basic SELECT to subqueries, set operations and DDL.
Study this deck: SQL: Queries, Joins & Aggregates
1 / 10SQL
Tap the card for the answer · swipe right if you knew it, left if not
What the 74 cards cover
The deck follows the order in which a real query is built, so each block prepares the next:
- Foundations: the four sublanguages (DQL, DDL, DML, DCL), keyword case-sensitivity,
SELECT *, column and table aliases withAS - Filtering:
WHEREoperators (=,!=,<,>,AND,OR,NOT),LIKEwith%and_,IN, inclusiveBETWEEN,IS NULL/IS NOT NULL - Shaping results:
ORDER BY(defaultASC),DESC,DISTINCT,LIMITvs SQL Server'sTOP - Joins:
INNER,LEFT(=LEFT OUTER),RIGHT,FULL OUTER,CROSS JOINCartesian product, self-joins with aliases - Aggregates:
COUNT(*)vsCOUNT(column),SUM,AVG,MIN,MAX,GROUP BY,HAVING, the full clause order - Subqueries and sets: scalar and correlated subqueries,
EXISTSvsIN,UNIONvsUNION ALLand its column rules - Writing data:
INSERT INTO,UPDATE,DELETE,DELETEvsTRUNCATE, and what happens when you forget theWHERE - Schema: primary and foreign keys, normalization,
CREATE/ALTER/DROP TABLE,INT,VARCHARvsCHAR,DATEvsTIMESTAMP,NOT NULL,UNIQUEvsPRIMARY KEY,DEFAULT
Sample flashcards
| Front | Back |
|---|---|
| Why can't you use = NULL? | NULL represents unknown, and any comparison with NULL returns NULL (not true or false) |
| LEFT JOIN | Returns all rows from the left table and matched rows from the right table (NULL for non-matches) |
| CROSS JOIN | Returns the Cartesian product of both tables (every row of table1 with every row of table2) |
| COUNT(*) vs COUNT(column) | COUNT(*) counts all rows; COUNT(column) counts non-NULL values in that column |
| WHERE vs HAVING | WHERE filters rows before grouping; HAVING filters groups after aggregation |
| Order of SQL clauses | SELECT, FROM, WHERE, GROUP BY, HAVING, ORDER BY, LIMIT |
| Correlated subquery | A subquery that references columns from the outer query (executes once per row) |
| UNION vs UNION ALL | UNION removes duplicates; UNION ALL keeps all rows (faster) |
| DELETE vs TRUNCATE | DELETE removes rows one by one (can be rolled back); TRUNCATE drops and recreates the table (faster, cannot be rolled back) |
| What happens if you omit WHERE in UPDATE? | All rows in the table will be updated (dangerous!) |
How to memorize the joins and aggregates
Draw the join before you flip the card. For the five join cards, sketch two overlapping circles on paper and shade the part each join returns: the intersection for INNER, the whole left circle for LEFT, both circles for FULL, and a grid of every pairing for CROSS. When the flashcard asks for RIGHT JOIN, recall the picture, not the sentence. The self-join card is the exception: draw the same table twice with different aliases.
Learn the clause order as an execution story. The card "SELECT, FROM, WHERE, GROUP BY, HAVING, ORDER BY, LIMIT" explains three other cards at once: because WHERE runs before GROUP BY, it cannot see an aggregate, which is exactly why HAVING exists and why "Can you use aggregate functions in WHERE?" is answered No. Recite the sequence, then re-derive those answers from it.
Pair every "dangerous" card with its fix. The two omit-the-WHERE cards and the DELETE vs TRUNCATE card are asked in interviews precisely because they cause outages. Answer them out loud with the safe version of the statement (DELETE FROM t WHERE id = 5;) instead of just the definition.
Study the deck in its natural blocks (filtering and NULL, then joins, then aggregates, then subqueries and DDL), then let Flip It's spaced repetition mix all 74 cards. Open the Flip It library, search for deck HP2801 "SQL: Queries, Joins & Aggregates", and start with the NULL cards: they are the shortest and the most often wrong.
Ready to learn faster? 🚀
Join FLIP IT for free and turn studying into a game.