This is personal study note
Copyright and original reference:
https://www.youtube.com/watch?v=y6Rpp9yEMQI&list=PLuHgQVnccGMDF6rHsY9qMuJMd295Yk4sa
================================================================================
Edit ERD
before:
after:
================================================================================
- Consider the relationship between 'Author' and 'Dormant'
- Cardinality
'One author' can have 'one dormant' (1)
'One dormant' can have 'one author' (1)
- Optionality
'One author' can have 'no dormant' (optional)
'One dormant' must have 'author' (mandatory)
- Table scheme
Author
id text dormant_id
1 kim 1
2 park 2
3 lee
Dormant
id dormant author_id
1 kim 1
2 park 2
author () : dormant (1)
author () : dormant (optional)
author (1) : dormant (1)
author (mandatory) : dormant (optional)
================================================================================
Create table for dormant
================================================================================
In 1:1 relationship, who should have FK? It's unclear
Author table is more super entity
In other words, dormant should know author table
But author table doesn't need to know dormant table
dormant table is depending on author table
Author table (parent table) : dormant table (child table)
Author table (PK) : dormant table (FK)
================================================================================
Drag and drop from parent to child tables
================================================================================
Install foreign key of author into Dormant table
================================================================================
The installed foreign key into Dormant table
================================================================================
1 0...1 means
author (1) : dormant (1)
author (mandatory) : dormant (optional)
================================================================================
author (1) : dormant (1)
author (mandatory) : dormant (optional)
author : dormant (foreign key of author is installed in dormant table)