Перейти к содержимому

SQL #07 — Primary Key, Foreign Key & JOINS (INNER, LEFT, RIGHT, Anti) — Connecting Tables in SQL

hosiyar

0:00 / 0:00

SQL #07 — Primary Key, Foreign Key & JOINS (INNER, LEFT, RIGHT, Anti) — Connecting Tables in SQL

203 просмотра · 1 мес. назад
hosiyar
885 подписчиков
203 просмотра · 1 мес. назад
Until now, all our queries have pulled data from one table at a time. But real databases aren't one giant spreadsheet — data is split across multiple tables on purpose. Employees in one table, departments in another. Students in one, courses in another. So how do you bring them back together when you need to? That's exactly what this lesson covers. We start with the why — primary keys and foreign keys, and how they create relationships between tables. Then we use those relationships to actually combine data using SQL JOINS: INNER JOIN, LEFT JOIN, RIGHT JOIN, and even the anti join pattern for finding rows that don't match. What you'll learn: Primary key — what makes each row unique Foreign key — how one table points to another How keys establish relationships between tables INNER JOIN — only matching rows from both tables LEFT JOIN — everything from the left table, matches from the right RIGHT JOIN — everything from the right table, matches from the left Anti join — finding rows with no match (using LEFT JOIN + WHERE IS NULL) When to use which join, with clear examples This is probably the most important lesson in the course so far. If you understand joins, you understand how real databases work. Take your time with this one. We use the same practice database from lesson #01. 📁 Practice SQL file & resources: https://github.com/deep473/hosiyar-re... This is lesson #07 of the full "SQL Zero to Advanced" course. If you haven't watched the earlier lessons, start from #00 — they build on each other. Joins confuse almost everyone the first time. If something doesn't click, tell me which join and at what timestamp — I'll help you in the comments. 🔗 Full SQL course playlist:    • SQL Full Course — From Zero to Advanced, S...   #SQL #MySQL #SQLJoins #InnerJoin #LeftJoin #PrimaryKey #ForeignKey #SQLForBeginners