P

PrepStack

SQL

SQL is the language you use to ask a relational database (data kept in tables) for data, and interviewers use it to see whether you think in sets rather than loops. The questions that come up again and again are joins (combining tables), GROUP BY with HAVING (grouping rows and filtering the groups), subqueries (a query inside a query), NULL (a missing value), and window functions (calculations across related rows). After this section you can say in what order a query is evaluated, choose the right join and predict its output, explain why WHERE x = NULL finds nothing, avoid the NOT IN trap, and use a window function to rank rows without collapsing them.

Topics in this section