📊 PostgreSQL – Filtering Groups with HAVING
So far in SQL, we’ve learned these keywords: FROM JOIN WHERE GROUP BY Now we’re introducing a new keyword: 🔥 HAVING At first, HAVING looks very similar to WHERE. But there is one very important diff
Search for a command to run...
So far in SQL, we’ve learned these keywords: FROM JOIN WHERE GROUP BY Now we’re introducing a new keyword: 🔥 HAVING At first, HAVING looks very similar to WHERE. But there is one very important diff
So far in this course, every query we’ve written has done one simple thing: 👉 It fetched rows exactly as they exist in the database. For example: SELECT * FROM users; This simply returns all rows. B
This is one of those topics that you will probably come back to again and again in the future. Joins are powerful — but they can also be confusing at first. So in this lesson, we are going to understa
In the last lesson, I mentioned two things in a very mysterious way: Sometimes the ordering of FROM and JOIN matters. There are different kinds of joins available in SQL. Now we’re going to unders
We’ve now written several JOIN queries. Before moving forward, there are some very important things you need to understand about JOIN syntax. These small details will save you from confusion later — e
Now we are entering one of the most important concepts in SQL: JOIN This is where SQL starts to feel like real backend development. The Problem We Want to Solve We want to answer this question: Fo
Up until now, we’ve been working with simple tables and writing basic queries. But in real-world applications, data is almost always connected across multiple tables. In this section, we are going to level up. We now have a database with: users ph...
In the previous lesson, we tested: 🔥 ON DELETE CASCADE When we deleted a user, all their related photos were automatically deleted. Now we’re going to explore a very different behavior: 🟡 ON DELETE SET NULL Instead of deleting related records…w...
So far, we’ve learned: What primary keys are What foreign keys are How insertion behaves when foreign keys are involved Now it’s time to look at the opposite operation: ❓ What happens when we try to DELETE a record that other records depend on?...