Monday, August 10, 2026
Home Academic Joins in SQL

Joins in SQL

With SQL, there are various JOIN types that let you combine data from different tables. Below is a quick summary of the most popular JOIN kinds and their syntax:

INNER JOIN: An INNER JOIN returns only the rows that match the join condition in both tables.
Syntax:

SELECT *
FROM table1
INNER JOIN table2
ON table1.column = table2.column;

Example:

SELECT employees.id, employees.name, department.name
FROM employees
INNER JOIN departments
ON employees.department_id = departments.id;

LEFT JOIN (or LEFT OUTER JOIN): A LEFT JOIN returns all rows from the left table (table1), even if there is no match in the right table (table2).
Syntax:

SELECT *
FROM table1
LEFT JOIN table2
ON table1.column = table2.column;

Example:

SELECT employees.id, employees.name, department.name
FROM employees
LEFT JOIN departments
ON employees.department_id = departments.id;

RIGHT JOIN (or RIGHT OUTER JOIN): A RIGHT JOIN returns all rows from the right table (table2), even if there is no match in the left table (table1).
Syntax:

SELECT *
FROM table1
RIGHT JOIN table2
ON table1.column = table2.column;

Example:

SELECT employees.id, employees.name, department.name
FROM employees
RIGHT JOIN departments
ON employees.department_id = departments.id;

FULL JOIN (or FULL OUTER JOIN): A FULL JOIN returns all rows from both tables, even if there is no match in either table.
Syntax:

SELECT *
FROM table1
FULL JOIN table2
ON table1.column = table2.column;

Example:

SELECT employees.id, employees.name, department.name
FROM employees
FULL JOIN departments
ON employees.department_id = departments.id;

Data from different tables can be combined using JOINs if they share a column or collection of columns. They are a crucial component of SQL and are commonly used in reporting and data analysis.

datasagarhttp://www.DataSagar.com
Sagar is multidisciplinary technologist, educator, and entrepreneur based in Nepal. As the founder of Illionso Technologies and Kashi Garden Resort, he operates at the intersection of web architecture, data intelligence, innovation, and digital transformation. From building digital solutions to scaling real-world concepts, his mission is to share knowledge alongside merge emerging as well as disruptive technologies with transformative offline experiences.
RELATED ARTICLES

What Is Vibe Coding? A Complete Beginner’s Guide to Building Software and Web Pages With AI

A few years ago, building a website meant sitting down with a programming book, picking a language, and slowly working through syntax...

What is Answer Engine Optimization (AEO)? Getting Ready for AI Powered Search and Agentic Era Digital Marketing

Search is changing faster than it has in the last two decades. For years, businesses focused on ranking their websites on search...

The Plain Text Web: Why llms.txt Is Becoming the New Site Standard

The web built today is heavy. Between client-side JavaScript, cookie banners, tracker scripts, and responsive CSS grids, a typical webpage carries megabytes...

Most Popular

What Is Vibe Coding? A Complete Beginner’s Guide to Building Software and Web Pages With AI

A few years ago, building a website meant sitting down with a programming book, picking a language, and slowly working through syntax...

What is Answer Engine Optimization (AEO)? Getting Ready for AI Powered Search and Agentic Era Digital Marketing

Search is changing faster than it has in the last two decades. For years, businesses focused on ranking their websites on search...

The Plain Text Web: Why llms.txt Is Becoming the New Site Standard

The web built today is heavy. Between client-side JavaScript, cookie banners, tracker scripts, and responsive CSS grids, a typical webpage carries megabytes...

Risks of Frontier AI in Agent driven world | Should Governments Slow Down AI Development?

Should governments slow AI development? Explore frontier AI risks, job automation, national security concerns, and global AI regulation efforts.