Relationship / Association


Relationship/association:

  • A relationship in a database refers to how data is connected or related between different tables. In relational databases, which are the most common type, relationships are typically established through keys, which are fields or columns in one table that refer to the primary key in another table.

In Database

  • The association between two different table of common field or different fields.
  • It is used for to create a link between tables.
  • In Relationship used a keys i-e Primary key, Secondary Key, Foreign Key.
  • It is used for to split the database and store data in a different tables.
Example:
                In Example, in a school database a STD table stores students data with a primary key field/ column named STD_ID; it is also Student data in FEE_DETAIL table, which holds information about various Fee section are associated Students. To these links determine a two tables STD and FEE_DETAIL information, a corresponding STD_ID must be inserted in the FEE_DETAIL table, referencing existing STD_ID from the STD table. In case, the FEE_DETAIL table's STD_ID column/ field is a foreign key that reference a column with the same name in the STD table. this is the best example of a relationship between the two table.

Comments