Joining two tables oracle example

student_details table:
select * from student_details;
id name
1 divya
2 hems
3 chudar

student_rank table:
select * from student_rank;
id rank
1 5
2 6
3 3

Joining both tables – selecting all:
select * from student_details sd,student_rank sr where sr.id=sd.id;
id name id_1 rank

1 divya 1 5
2 hems 2 6
3 chudar 3 3

Joining both tables – selecting only needed:
select sd.id,sd.name,sr.rank from student_details sd,student_rank sr where sr.id=sd.id;
id name rank
1 divya 5
2 hems 6
3 chudar 3

Leave a Reply