Code has been added to clipboard!

How to Combine Table Rows Using SQL JOIN

Reading time 1 min
Published Aug 11, 2017
Updated Oct 3, 2019

SQL Joins: Main Tips

  • SQL joins are used to combine more than one tables rows.
  • SQL INNER JOIN is the most common JOIN. An SQL INNER JOIN returns all multiple tables rows where the join condition is met.

SQL Join: Types

  • LEFT JOIN: It returns the left table rows and right table rows which matched.
  • RIGHT JOIN: It returns the right table rows, and left table rows which matched.
  • INNER JOIN: It returns all rows when there is the same record in BOTH tables.
  • FULL OUTER JOIN: It returns all rows when the same record occurs in BOTH tables.
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

This is a demo example from the "Orders" table in the database:

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

This is a demo example from the "Developers" table in the database:

ID Name City Country
1 Tom Kurkutis New York USA
2 Ana Fernandez London UK
3 Antonio Indigo Paris France
4 Aarav Kaelin Delhi India
5 Andrew Tumota Miami USA

INNER JOIN: Example

Example
SELECT Customer_orders.ID, Developers.Name
FROM Customer_orders
INNER JOIN Developers ON Customer_orders.employee_id = Developers.ID;

The result table looks like this:

ID Name Date
1509 Tom Kurkutis 8/18/2017
1510 Andrew Tumota 12/19/2016
1511 Andrew Tumota 01/25/2017

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