</>
Skip to content
PostgreSQL lessons (19/38)

PostgreSQL — Joins

Inner Join

SELECT users.name, orders.total
FROM users
INNER JOIN orders ON users.id = orders.user_id;

Left Join

SELECT users.name, orders.total
FROM users
LEFT JOIN orders ON users.id = orders.user_id;

Right Join

SELECT users.name, orders.total
FROM users
RIGHT JOIN orders ON users.id = orders.user_id;

Full Outer Join

SELECT users.name, orders.total
FROM users
FULL OUTER JOIN orders ON users.id = orders.user_id;

Cross Join

SELECT users.name, products.name
FROM users
CROSS JOIN products;

Join Types

TypeDescription
INNERMatching rows only
LEFTAll left, matching right
RIGHTAll right, matching left
FULLAll rows from both
CROSSCartesian product

Mini Practice

  1. Use inner join
  2. Use left join
  3. Use right join
  4. Use full outer join

Up Next

Continue with Inner Join — inner join details.

Related Topics

Frequently Asked Questions about Joins

What is Joins in PostgreSQL?

Joins is a fundamental concept in PostgreSQL. This lesson explains it step by step with clear examples, making it easy for beginners to understand.

How do I learn Joins?

Start by reading the explanation above, then try the code examples. Practice by modifying the examples and experimenting with different values. Hands-on practice is the best way to learn Joins.

Why is Joins important in PostgreSQL?

Joins is essential for PostgreSQL development. Understanding this concept will help you write better code and solve real-world problems more effectively.