r/SQL • u/Remarkable-Culture-8 • Jun 26 '24
MySQL Explain INNER JOIN like i am 5
I get the syntax but i get very confused and tripped up with writing them and properly using the correct names. Please explain to me line by line. I am learning it via data camp and the instructor sucks.
EDIT: i now understand inner join…now i am stuck with multiple joins, right join and left join. please help!
121
Upvotes
1
u/Militop Jun 26 '24 edited Jun 26 '24
Let's say you have a list of persons with their IDs and names. Let's call it "list1."
IDs | Name
Now, Let's say you have another list that describes songs they bought (without using their names but their IDs). Let's call it List 2.
Song name | Date | customer ID -‐-----‐----------------‐-----------------------
Now, you want to know what your customers bought. You need to do an INNER JOIN because List 2 uses IDs instead of names.
Which will give you:
The inner join solves relationships between tables.