From the course: Oracle Database 12c: Basic SQL

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

RIGHT JOIN

RIGHT JOIN - Oracle Database Tutorial

From the course: Oracle Database 12c: Basic SQL

Start my 1-month free trial

RIGHT JOIN

- [Instructor] In similar fashion to left join in the SQL language, right join do the same thing, only flipped around. That is, a SQL right join will return all records from the right table, that is the departments table in our case, and any matching rows from the left table, that is the employees table in our case. Using a right join in SQL is as simple as specifying right join as part of the from clause of your SQL command. So let's see right joins in action. We can simply change the query from our previous video, and instead of specifying inner join or left join, you can just specify right join. We can also get rid of the select query from the employees table, as we have no use for it right now. So again, we've typed our SQL query, specifying right join between the employees and the departments table, using the same join condition, that is department_id. Let's execute our query and see which data we get back from our database. So as you can see, the query functioned as expected…

Contents