This content originally appeared on DEV Community and was authored by Ramya .C
Today I explored SQL Joins – one of the most important concepts in relational databases and also practiced with some coding problems on HackerRank.
Types of Joins
- INNER JOIN → Returns only the matching rows from both tables.
- LEFT JOIN → Returns all rows from the left table + matched rows from the right table.
- RIGHT JOIN → Returns all rows from the right table + matched rows from the left table.
- FULL JOIN (or OUTER JOIN) → Returns all rows when there is a match in one of the tables.
Among these, the most commonly used is the INNER JOIN.
✅ INNER JOIN Example
Let’s say we have two tables:
movies
movie_id | movie_name |
---|---|
1 | Ghajini |
2 | Singam |
3 | Kaakha Kaakha |
actors
actor_id | actor_name |
---|---|
1 | Surya |
2 | Asin |
3 | Jyothika |
movie_actors
movie_id | actor_id |
---|---|
1 | 1 |
1 | 2 |
3 | 1 |
3 | 3 |
📝 Query (INNER JOIN)
SELECT m.movie_name, a.actor_name
FROM movies m
INNER JOIN movie_actors ma ON m.movie_id = ma.movie_id
INNER JOIN actors a ON ma.actor_id = a.actor_id;
Output
movie_name | actor_name |
---|---|
Ghajini | Surya |
Ghajini | Asin |
Kaakha Kaakha | Surya |
Kaakha Kaakha | Jyothika |
This content originally appeared on DEV Community and was authored by Ramya .C

Ramya .C | Sciencx (2025-08-20T18:33:49+00:00) Day 22 of My Data Analytics Journey !. Retrieved from https://www.scien.cx/2025/08/20/day-22-of-my-data-analytics-journey/
Please log in to upload a file.
There are no updates yet.
Click the Upload button above to add an update.