Category · 11 articles
Sql
The Art of SQL JOINs: Combining Data from Multiple Tables
A JOIN combines rows from two or more tables based on a related column. That's it. No magic.
26 May 2024
Aggregates in SQL
Aggregate functions collapse many rows into a single value. Instead of getting a list of every row, you get one number: a total, an average, a count.
13 May 2024
Exploring SQL Subqueries: Advanced Queries for Data Analysis
A subquery is a SELECT inside another SELECT. It lets you ask questions that depend on the answer to another question -- all in one query.
7 May 2024
SQLZoo SELECT Queries with Order BY
I practiced SQL fundamentals using the Nobel Prize database from SQLZoo. Each query below solves a specific filtering or sorting problem. They start simpl...
4 May 2024
SQLZoo SELECT from WORLD: Solutions and Explanations
Worked solutions to every SQLZoo SELECT from WORLD exercise, from basic filtering to population and GDP-per-capita queries, each explained step by step.
3 May 2024
What is the difference between UNION and UNION ALL?
Both UNION and UNION ALL stack the results of two SELECT statements on top of each other. The difference is what happens to duplicates.
29 Apr 2024
What is the difference between GROUP BY and HAVING clauses?
WHERE filters rows. HAVING filters groups. That's the core difference.
29 Apr 2024
Calculating Total Sales by Product Category
"What's our total revenue by product category?" Every business asks this question eventually. It's the kind of query that combines JOINs and aggregates --...
29 Apr 2024
Retrieving Employee Information with Department Name
A classic SQL problem: employees are in one table, departments in another. You need both together.
29 Apr 2024
Understanding Database Aggregates in TypeScript
Aggregate functions take many rows and return one value. "How many users?" "What's the average order size?" "What's the highest salary?"
29 Apr 2024
How to Select and SubQuery in SQL Syntax
SQL has a small number of statements that combine to handle almost any data question. Here's a quick reference for the patterns I use most.
10 Apr 2024