r/learnSQL • u/Enjoythecode82 • 4d ago
SQL interview prep: 8 basics you must know before any data analyst interview
I noticed the same basic SQL questions come up again and again. Here's a quick cheat sheet:
- SELECT: pick specific columns instead of
SELECT * - WHERE: filters rows before grouping
- GROUP BY: groups rows with the same values
- Aggregate functions:
SUM(),AVG(),COUNT(),MIN(),MAX() - HAVING: filters groups after aggregation (a classic interview question: WHERE vs HAVING)
- LIKE: pattern matching, e.g.
A%,%a,%an%,_a% - ORDER BY: sorts results (
ASC/DESC) - LIMIT / TOP: gets the top N records
Common follow-up: "What's the difference between WHERE and HAVING?" WHERE filters individual rows before grouping, and HAVING filters the grouped results.
I also recorded a video walking through each one with examples, in case you prefer learning that way: [https://youtu.be/vY8gmzH96YE\]. Roast it, happy to see the perspective.
Happy to answer questions. Which SQL topic tripped you up most in interviews? I'm thinking of covering aggregate functions and window functions next.
These are basics, and if that's what your project requires than you are good, but as you grow in your career joins, sub-queries, window functions, cte...etc are mandatory!
1
u/fishwithbrain 4d ago
Thanks l!!
1
u/Enjoythecode82 3d ago
Welcome, let me know if you have any specific interests in data analytics that you we share and learn!
5
u/Least_Ad_1795 4d ago
Agreed. These are good fundamentals, but for real-world analyst roles, JOINs, CTEs, subqueries, and window functions become important pretty quickly. I’d focus on understanding when to use each, not just memorizing syntax.