Here’s SQL query to join three tables and fetch data from two table without using join keyword.
Here are three tables used in join query
- mystudent_table
- mycourse_table
- mystudent_course_table
Here’s SQL query to join multi tables

The three tables
1. Columns in mystudent_table
student_id
last_name
first_name
class_code
grade_pt
Here is an article on LEFT Vs RIGHT Join and which is better.
2. Columns in mycourse_table
course_id
course_name
credits
seats
Here is blog post on How to use LEFT and RIGHT functions to get Substring.
3. Columns in mystudent_course_table
student_id
course_id
Join SQL query
SELECT ALL Columns from the mycourse_table and mystudent_table and Join them. In the first WHERE condition, you can see the equi join on student id. The next condition, is on course id. The result is you will all the rows from two tables (S* and C*).
select s*, c*
from mystudent_table s
mycourse_table c
mystudent_course_table sc
where s.student_id = sc.student_id
and c.course_id = sc.course_id;
The purpose of mystudent_course_table is just a bridge between these two tables.
Related Posts
You must be logged in to post a comment.