Relational Databases: Difference between revisions
Jump to navigation
Jump to search
(→TODO) |
|||
Line 3: | Line 3: | ||
* [[SQL]] | * [[SQL]] | ||
=Multiplicity (Cardinality)= | |||
The cardinality specifies how many instances of data can participate in a relationship. There are three different types of cardinality: | |||
==One-to-One (1:1) Relationships== | |||
[[File:Multiplicity_One_to_One.png]] | |||
In a one-to-one relationship, each constituent can have at most one relationship with the other constituent. 1:1 relationships are typically set up by a foreign key relationship in the database. The foreign key column can be set in either table. In practice, 1:1 relationships will be combined into a single table, rather than having a relationship between two separate data objects, so 1:1 relationships are not very common. | |||
=TODO= | =TODO= |
Revision as of 03:50, 16 October 2018
Internal
Multiplicity (Cardinality)
The cardinality specifies how many instances of data can participate in a relationship. There are three different types of cardinality:
One-to-One (1:1) Relationships
In a one-to-one relationship, each constituent can have at most one relationship with the other constituent. 1:1 relationships are typically set up by a foreign key relationship in the database. The foreign key column can be set in either table. In practice, 1:1 relationships will be combined into a single table, rather than having a relationship between two separate data objects, so 1:1 relationships are not very common.
TODO
Object IDs
When persisting objects in a relational database, it is generally a good idea to have one field in the object that uniquely identifies the object.