DataBase/MYSQL

Primary Key, Foreign Key

Naranjito 2022. 7. 25. 15:52
  • The primary key is the criteria of the table. In other words, criteria table key is primary key.

 

- Example1 : When join parent table with child table 1, primary key of parent table is a criteria key. 

Parent Table
Primary Key Foreign Key

Join : Primary Key<->Foreign Key

Child Table 1
Primary Key Foreign Key

 

 

- Example2 : When join child table 1 with child table 2, primary key of child table1 is a criteria key. 

Join : Primary Key<->Foreign Key

Child Table 2
Primary Key Foreign Key

 

 

'DataBase > MYSQL' 카테고리의 다른 글

SQL, Docker-compose, Python module  (0) 2022.02.03
Common SQL queries in Pandas  (0) 2022.01.24
SQL error:may be the input source is a directory or a block device  (0) 2022.01.24
How to run mySQL through docker-compose.  (0) 2022.01.13
MYSQL Query  (0) 2022.01.13