What are the different types of relationships in SQL ?

  • Data base collects different types of data that uses tables, record, and columns.
  • For easy storage of data, a well-defined relationship is created between tables and databases.
  • Data in a table is based on a relational model.
  • A unique Id and the key is created for each row.
  • Data attributes are held in the column of the table.

Different Types of Relational DataBase Tables

One to One Relationship

  • This relationship helps to create a relationship between tables where a single row of the first table can only be related to one and only one record of the second row.
  • The same way one record of the second table can be related to one and only one record of the first table.

One to many Relationship

  • This helps to create a relationship between the two tables.
  • Any single row of a table can be connected to one or more rows in a second table.
  • Rows from the second table can relate to only one row in the first table. This relationship is known as one to many relationship.

Many to Many Relationship

  • Here relationship is created between two tables.
  • Each record in the first table can be related to many records in the second table.
  • Similarly, each record from the second row can relate to any records in the first row.
  • It is represented as N: N.

Leave a Reply

Your email address will not be published.

You May Also Like