Database ERD-Guiding Beacon
Sign in

Database ERD-Guiding Beacon

All the entities you come across in the ERD’s generally get resolved in the data files/tables. Please recall that the terms ‘file’ and ‘table’ are interchangeably used. Relations are mapped onto table design by referencing which is storing a primary key of one table in some other table. If it is a one-to-one relation, typically both the entities could be merged together.

In case of a one-to-many relation, both the entities stand as separate tables, with the primary key of the first entity appearing in the second, too (as a foreign key, as explained elsewhere). Please note that many-to-one relationship would be just a replica of one-to-many relationship and hence is not discussed separately. Lastly, if it is many-to-many relationship, the relation itself gets resolved into yet another table with its primary key as composition of primary keys of both the tables. A few examples will make this point clear for you:

 

One-to-many relationship

 

Consider a political system where a state contains several districts. As one state contains multiple districts – and the number of districts varies from state to state – we cannot think of storing a district code in the state file. It may need multiple district fields within a single state file. (Remember, the repeating groups’ problem in normalization?) However, it is possible to relate the two entities by storing the state code in the district file, as there is just one state for each district.

Related links: Database Assignment Help

start_blog_img