...

/

The One-to-Many Relationship

The One-to-Many Relationship

In this lesson, we will get to know how to add a one-to-many relationship between models.

Introduction #

While working with databases, one of the key concepts is the relationship between tables. The types of relationships that exist are:

  • One-to-many
  • One-to-one
  • Many-to-many

In the next few lessons, we will cover how to represent and create these relationships between the models using SQLAlchemy.

Consider the Human Resource Management System(HRMS) of a company. The application would contain the following models.

  • Employee
  • Department
  • Project

A simple implementation of these models is given below.

Access this course and 1400+ top-rated courses and projects.