Code has been added to clipboard!

Matching Data From Multiple Tables with SQL RIGHT JOIN

Reading time 1 min
Published Aug 9, 2017
Updated Oct 10, 2019

SQL RIGHT JOIN Keyword: Main Tips

  • This keyword brings back every row out of the right table into the same rows on the left table.
  • The value contained in the first table is NULL where the rows were not matched.

Syntax of SQL RIGHT JOIN

Example
SELECT column_name(s)
FROM tbl1
RIGHT JOIN tbl2 ON tbl1.column_name = tbl2.column_name;
Udacity
Pros
  • Simplistic design (no unnecessary information)
  • High-quality courses (even the free ones)
  • Variety of features
Main Features
  • Nanodegree programs
  • Suitable for enterprises
  • Paid certificates of completion
Coursera
Pros
  • Professional service
  • Flexible timetables
  • A variety of features to choose from
Main Features
  • Professional certificates of completion
  • University-level courses
  • Multiple Online degree programs
Datacamp
Pros
  • Great user experience
  • Offers quality content
  • Very transparent with their pricing
Main Features
  • Free certificates of completion
  • Focused on data science skills
  • Flexible learning timetable

Demo Database

The "Orders" database table below:

ID Customer_ID Employee_ID
20408 2 7
20409 2 5
85471 1 3
75864 5 8

The "Employees" database table below:

ID Last_Name First_Name Birthdate Photos Note
1 Bob Bobby 11/18/1965 EmpID1.pic Cars are an important thing in my life...
2 Bill Billy 5/14/1954 EmpID2.pic Books are an important thing in my life...
3 Ben Benny 4/25/1967 EmpID3.pic Music is an important thing in my life...

SQL RIGHT JOIN: Example

The code example below will bring back every data record from employees with all the placed orders:

Example
SELECT Customer_orders.ID, Employees.Last_name, Employees.First_name
FROM Customer_orders
RIGHT JOIN Employees ON Customer_orders.employee_id = Employees.ID
ORDER BY Customer_orders.ID;

Latest Udacity Coupon Found:

Verified STAFF PICK

75% OFF COURSES

Udacity Black Friday Offer

The best time to save on Udacity courses is now - follow this coupon to access a 75% Udacity Black Friday discount & enjoy learning at a very low cost!

Expiration date: 28/02/2021
3176 People Used
Only 97 Left
Rating
5.0