Most aspiring data analysts spend months trying to learn everything about SQL before they apply for a job. That is the wrong approach. The reality of most data analyst roles is that 80% of the work is covered by 10 query patterns. Learn these 10 and you can handle most real-world tasks from day one.
1. SELECT * — pull everything from a table
SELECT * FROM orders; — retrieves every column and row from the orders table. Use this to explore a new table and understand its structure. Not for production — always be more specific in real work.
2. SELECT specific columns — pull only what you need
SELECT customer_id, order_date, total FROM orders; — retrieves only the three columns you care about. Cleaner output and much faster on large tables.
3. WHERE — filter rows by condition
SELECT * FROM orders WHERE status = 'completed';— returns only rows where the status column equals 'completed'. Combine conditions with AND and OR. This is the workhorse of every analyst query.
4. ORDER BY — sort results
SELECT * FROM orders ORDER BY order_date DESC; — sorts results by order_date from newest to oldest. Add ASC for ascending order. Use this any time you want to see the most recent, highest, or lowest values first.
5. LIMIT — cap the number of rows returned
SELECT * FROM orders LIMIT 100; — returns only the first 100 rows. Always use LIMIT when exploring large tables — it prevents accidental timeouts and keeps queries fast.
6. GROUP BY + COUNT / SUM / AVG — aggregate data
SELECT status, COUNT(*) FROM orders GROUP BY status; — counts how many orders exist for each status. Swap COUNT(*) for SUM(total) or AVG(total) to get totals or averages. This pattern answers most "how many" and "how much" business questions.
7. INNER JOIN — combine rows from two tables
SELECT o.order_id, c.name FROM orders o INNER JOIN customers c ON o.customer_id = c.id;— pulls order data alongside the matching customer name. INNER JOIN returns only rows that have a match in both tables.
8. LEFT JOIN — keep all rows from the left table
SELECT c.name, o.order_id FROM customers c LEFT JOIN orders o ON c.id = o.customer_id;— returns all customers, including those who have never placed an order (their order_id will be NULL). Use LEFT JOIN when you want to find unmatched records or keep the full left-side dataset regardless of matches.
9. Subqueries — use a query inside a query
SELECT * FROM orders WHERE total > (SELECT AVG(total) FROM orders);— returns all orders with a total above the average. Subqueries let you use the result of one query as a filter or value inside another, without needing to store intermediate results.
10. CASE WHEN — add conditional logic to your output
SELECT order_id, CASE WHEN total > 500 THEN 'high' ELSE 'low' END AS order_size FROM orders;— creates a new column called order_size that labels each row based on its total. CASE WHEN is SQL's version of an if-else statement, and it is essential for segmenting and categorizing data in your output.
Do not learn the whole SQL spec — learn these 10 patterns and you are 80% of the way there. The remaining 20% (window functions, CTEs, advanced aggregations) you will pick up naturally as you encounter real problems that need them. Start applying these on a public dataset today and you will be more prepared for a data analyst interview than someone who spent months on a SQL course without writing real queries.