Home > Database > Mysql Tutorial > body text

Minimization of ER diagrams

WBOY
Release: 2023-09-10 23:37:10
forward
714 people have browsed it

Problem Statement

ER diagram is a graphical representation showing various tables and the relationships between them. ER diagram we can reduce the number of databases.

One-to-One Cardinality

Let us consider the following one-to-one Cardinality diagram-

Minimization of ER diagrams

In this ER diagram, employees can Work for one company, but a company can have many such employees. The above ER diagram represents 3 entities -

  • Employee entity has 2 attributes namely - emp_id and emp_name. emp_id is the primary key
  • Company entity has 2 attributes namely- emp_id and cmp_name. cmp_id is the primary key
  • We cannot use cmp_id as the primary key because multiple employees can work for the same cmp_id. However, we can combine the Employee and Work tables. Therefore, at least 2 tables are required in a one-to-many cardinality scenario.

Many-to-Many Cardinality

Let us consider the one-to-many cardinality of the following diagram -

Minimization of ER diagrams

In this ER diagram , employees can work for multiple companies. A company can have many such employees. The above ER diagram represents 3 entities -

  • Employee entity has 2 attributes namely - emp_id and emp_name. emp_id is the primary key
  • Company entity has 2 attributes namely- emp_id and cmp_name. cmp_id is the primary key
  • Unlike the previous example, the worksheet cannot be merged with Employee or Company. If we try to merge it, redundant data will be created. So at least 2 tables are required in many to many cardinality scenario

The above is the detailed content of Minimization of ER diagrams. For more information, please follow other related articles on the PHP Chinese website!

source:tutorialspoint.com
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!