individual relationship

One-to-one relationships are an essential part of building a database

A one-to-one relationship occurs when there is exactly one item in the first table that matches one item in the related table. For example, US citizens have a Social Security number. Only one number is assigned per person, so a person cannot have multiple numbers.

Here’s another example using the two tables below. The tables have a one-to-one relationship because each row in the first table is directly related to another row in the second table.

Personnel number td> Name td> Last name td>
TR>
123TD> Rick TD> Rossin TD>
TR>
456TD> Rob TD> Halford TD>
TR>
789TD> Eddie TD> Henson TD>
TR>
567TD> Amy TD> Bond TD>
TR>
table>


So the number of rows in the table with the employee’s name must match the number of rows in the table with the employee’s title.

personnel number td> Position TD> PhoneExt. td>
TR>
123TD> Associate TD> 6542TD>
TR>
456TD> TD Manager> 3251TD>
TR>
789TD> Associate TD> 3269TD>
TR>
567TD> TD Manager> 9852TD>
TR>
table>


Another type of database model is the one-to-many relationship. From the table below, you can see that Rob Halford is a manager, so his relationship to the position is unambiguous as there is only one position in this company. But the manager position includes two people, Amy Bond and Rob Halford, who have a one-to-many relationship. One position, many people.

Learn more about database relationships, foreign keys, joins, and ER diagrams.

Rate the article


solutics.ru

Add a comment cancel reply

















Leave a Reply

Your email address will not be published.