🌍 Data Analytics · flashcards
Data Analytics Data Wrangling and SQL Flashcards
51 question-and-answer cards covering Data Wrangling and SQL as it is examined in Data Analytics. 24 of them are printed below, taken from across the deck — no signup, no paywall on the preview.
24 sample cards from the Data Wrangling and SQL deck
Sampled from the end of the deck, so these are different cards from the ones shown on the syllabus page.
What does the LIMIT clause do in SQL?
LIMIT restricts the number of rows returned by the query, e.g. LIMIT 10 returns at most 10 rows. Combined with ORDER BY it gives 'top N' results; OFFSET can skip rows for pagination.
What does the DISTINCT keyword do in a SELECT statement?
DISTINCT removes duplicate rows from the result set, returning only unique combinations of the selected columns. Example: SELECT DISTINCT country FROM customers returns each country once.
What is a column alias in SQL, and how is it created?
An alias is a temporary, readable name given to a column or expression in the result set, created with the AS keyword (AS is optional). Example: SELECT price * quantity AS total_cost. Table aliases work similarly, e.g. FROM customers AS c.
What does the GROUP BY clause do in SQL?
GROUP BY groups rows that share the same values in specified columns into summary rows, so aggregate functions can be applied per group. Example: SELECT country, COUNT(*) FROM customers GROUP BY country.
What is the difference between the WHERE and HAVING clauses in SQL?
WHERE filters individual rows before grouping and cannot use aggregate functions. HAVING filters groups after GROUP BY and can use aggregates. Example: HAVING COUNT(*) > 5 keeps only groups with more than 5 rows.
List the five main SQL aggregate functions and what each computes.
COUNT: number of rows/values. SUM: total of numeric values. AVG: arithmetic mean. MIN: smallest value. MAX: largest value. All operate over a group (or the whole table if no GROUP BY).
How does COUNT(*) differ from COUNT(column_name) in SQL?
COUNT(*) counts all rows including those with NULLs. COUNT(column_name) counts only rows where that column is not NULL. COUNT(DISTINCT column) counts distinct non-null values.
What is the logical execution order of the main SQL clauses (FROM through ORDER BY)?
FROM (and JOINs) → WHERE → GROUP BY → HAVING → SELECT → DISTINCT → ORDER BY → LIMIT. This is why aliases defined in SELECT usually can't be used in WHERE but can be used in ORDER BY.
What does an INNER JOIN return?
An INNER JOIN returns only the rows that have matching values in both tables based on the join condition. Rows with no match in either table are excluded.
What is the difference between a LEFT JOIN and a RIGHT JOIN?
A LEFT JOIN returns all rows from the left (first) table plus matching rows from the right, with NULLs where no match exists. A RIGHT JOIN returns all rows from the right (second) table plus matching rows from the left, with NULLs where no match exists.
What does a FULL OUTER JOIN return?
A FULL OUTER JOIN returns all rows from both tables: matched rows are combined, and unmatched rows from either side appear with NULLs for the missing side's columns.
What is a CROSS JOIN, and how many rows does it produce?
A CROSS JOIN returns the Cartesian product of two tables: every row of the first table paired with every row of the second. If the tables have $m$ and $n$ rows, the result has $m \times n$ rows.
What is a self join in SQL, and when is it used?
A self join is a join of a table to itself, using table aliases to distinguish the two copies. It is used for hierarchical or comparative data within one table, e.g. matching employees to their managers stored in the same employees table.
What is the basic syntax to join two tables on a matching key in SQL?
SELECT columns FROM tableA a INNER JOIN tableB b ON a.key = b.key. The ON clause specifies the matching condition; using aliases (a, b) qualifies which table each column comes from.
What does the UNION operator do in SQL, and what are its requirements?
UNION combines the result sets of two or more SELECT statements into one, stacking rows vertically. Each SELECT must have the same number of columns with compatible data types in the same order. UNION also removes duplicate rows.
What is the difference between UNION and UNION ALL?
UNION removes duplicate rows from the combined result (requiring a de-duplication step). UNION ALL keeps all rows including duplicates and is therefore faster because no duplicate check is performed.
How does a UNION differ conceptually from a JOIN?
A JOIN combines tables horizontally, adding columns by matching rows on a condition. A UNION combines queries vertically, stacking rows on top of each other; the queries must have compatible column structures.
What is a subquery in SQL?
A subquery (inner query) is a query nested inside another SQL statement. It can appear in the SELECT, FROM, or WHERE clause and provides a value, a list, or a derived table used by the outer query.
What is the difference between a correlated and a non-correlated (self-contained) subquery?
A non-correlated subquery runs independently once and passes its result to the outer query. A correlated subquery references columns from the outer query and is re-evaluated for each row the outer query processes, making it typically slower.
When must you use IN (or ANY) versus = with a subquery in a WHERE clause?
Use = only when the subquery is guaranteed to return a single value (one row, one column). Use IN (or ANY/ALL) when the subquery returns multiple values, e.g. WHERE id IN (SELECT id FROM orders).
What is a Common Table Expression (CTE), and what keyword introduces it?
A CTE is a named, temporary result set defined at the start of a query with the WITH keyword and referenced within that single statement. Syntax: WITH cte_name AS (SELECT ...) SELECT ... FROM cte_name. It improves readability of complex queries.
What are two advantages of using a CTE over a nested subquery?
(1) Readability/reusability: a CTE is named and can be referenced multiple times in the same query instead of repeating a subquery. (2) It allows recursion (recursive CTEs) for hierarchical data, which plain subqueries cannot do; it also lets you structure logic top-to-bottom.
What is a recursive CTE used for?
A recursive CTE references itself to process hierarchical or tree-structured data, such as organizational charts, bill-of-materials, or graph traversals. It has an anchor member (base case) combined via UNION ALL with a recursive member that repeats until no new rows are produced.
In SQL, what is the difference between using EXISTS and IN with a subquery for filtering?
IN compares a column's value against the list of values returned by the subquery. EXISTS returns TRUE as soon as the (usually correlated) subquery returns any row, stopping early. EXISTS is often more efficient for large subquery results and handles NULLs more predictably than IN.
What this deck covers
The Data Wrangling and SQL deck follows the Data Analytics Data Wrangling and SQL syllabus — 6 chapters and 27 topics — so questions land on material that is genuinely examinable rather than trivia around it. That works out to roughly 8.5 cards per chapter.
Answers are written to be recallable, not just readable — averaging about 213 characters, which is long enough to carry the reasoning and short enough to say out loud.
A deck like this earns its keep on the second and third pass. Read the syllabus first so you know the shape of the subject, then use the cards to find the specific facts that have not stuck.
Data Wrangling and SQL flashcards FAQ
How many Data Wrangling and SQL flashcards are in this Data Analytics deck?
51 cards. This page previews 24 of them, sampled evenly across the deck so you can judge the difficulty before installing anything.
Are these Data Analytics flashcards free?
Yes. The preview here is free to read with no signup, and the full 51-card deck is free inside the Examius app.
What do the Data Wrangling and SQL cards cover?
They follow the Data Analytics Data Wrangling and SQL syllabus — 6 chapters and 27 topics — so the questions track what is actually examinable.
How should I use these flashcards?
Read the syllabus first so you know the shape of the subject, then drill the deck. Examius schedules each card with spaced repetition, so cards you keep missing come back sooner and ones you know drift further apart.