Skip to main content
Practice

What are Joins?

In relational databases, tables are designed to focus on a single subject or entity such as customers, orders, or courses. This avoids duplication and makes data easier to manage.

But to answer real-world questions, you often need to bring those separate tables together.

This is where joins come in.


Joins in Context

Rather than storing everything in one large table, databases use a normalized design by breaking data into logical pieces. For example:

  • students might store student profiles
  • enrollments might track which students joined which classes

These tables are related through a shared column, often an ID. A join lets you temporarily rebuild the full picture for analysis.


Real-World Use Cases

Joins can be used to:

  • Show each customer along with their purchases
  • Combine user accounts with their login history
  • Match employees to their departments or roles

In short, joins reveal the full power of relational databases.


A Note on Join Types

There are several types of joins, each with its own behavior, depending on whether you want only matching records, all records from one side, or a complete union.

You can find an overview of these join types in the slides on the right side of your screen.

Want to learn more?

Join CodeFriends Plus membership or enroll in a course to start your journey.