Explain different types of relationships in SQL

Submitted 3 years, 2 months ago
Ticket #341
Views 239
Language/Framework SQL
Priority Low
Status Closed

Thanks in advance

Submitted on Feb 04, 21
add a comment

1 Answer

Verified

There are 3 different types of relationships in Structured Query Language (SQL).

1.  One-to-one relationships: In a one-to-one (1:1) relationship means one record in a table is related with one and only one record in another table.

For example, in a office database, each employee has only one employee ID, and each employee ID is assigned to only one person.

2. One-to-many relationships: In a one-to-many relationship means one record in a table can be related with one or more records in another table. 

For example, each customer can have many sales orders.

3. Many-to-many relationships: A many-to-many relationship means when multiple records in a table are related with multiple records in another table.

 For example, customers can purchase many items, and items can be purchased by many customers.

Submitted 3 years, 2 months ago


Latest Blogs