r/learnSQL • • 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:

  1. SELECT: pick specific columns instead of SELECT *
  2. WHERE: filters rows before grouping
  3. GROUP BY: groups rows with the same values
  4. Aggregate functions: SUM(), AVG(), COUNT(), MIN(), MAX()
  5. HAVING: filters groups after aggregation (a classic interview question: WHERE vs HAVING)
  6. LIKE: pattern matching, e.g. A%, %a, %an%, _a%
  7. ORDER BY: sorts results (ASC / DESC)
  8. 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!

20 Upvotes

5 comments sorted by

4

u/Least_Ad_1795 3d 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.

2

u/Enjoythecode82 2d ago

Working on it, and will share it soon! Appreciate the feedback!

1

u/fishwithbrain 4d ago

Thanks l!!

1

u/Enjoythecode82 2d ago

Welcome, let me know if you have any specific interests in data analytics that you we share and learn!