Are you talking about primary keys
?
Being a relational database, mysql uses primary key
s and indexes
to joint data the way you want to achieve.
Primary keys join tables in an efficient way, PK
in the the origin or parent table and FPK
, Foreign Primary Key in the related table.
When creating a table, in mysql workbench
or phpmyadmin
, define a primary key
, just one per table and if needed indexes and if needed foreign keys.
Use union
statements to join two or more tables.
Always use numeric keys data_type INT
instead of natural, string keys. Also make then autoincrement
and Not Null
.
mysqlworkbench has an exporting tool, which allows you to export each created table, including their keys, indexes and cascading. You can copy and paste to create tables in phpmyadmin.