๐Ÿ“Š We use cookies & analytics to improve your experience. Learn more
Latest

Data Analytics with SQL & Excel Module 2 ยท Lesson 6 of 15

0% Exit to course

Module 2 ยท SQL โ€” asking the database directly Lesson 6 of 15

JOIN โ€” combining two tables

Learning objective

Data lives in separate tables: sales in one, customers in another. A join brings them together on a shared key.

Worked example

SELECT c.name, SUM(s.amount) FROM customers c JOIN sales s ON s.customer_id = c.id GROUP BY c.name ORDER BY 2 DESC gives your top customers.

Your practice task

Join two of your tables, once with JOIN and once with LEFT JOIN, and explain in one line the difference in the rows that came back.

Do this before moving on. Reading a solution teaches the shape of it; typing it teaches you.

Key takeaway

Data lives in separate tables: sales in one, customers in another. A join brings them together on a shared key.

Create free account or sign in

Almost there

15 lessons left of 15

Finish every lesson to unlock the certificate. Each one ends in a practice task โ€” do them and the final project brief writes itself.

Next recommended course Interview DSA Crash Course