The Woork Handbook

Page 75

T H E

W O O R K

H A N D B O O K

v

0 . 1

How to define relationships using phpMyAdmin If you use a MySQL database and phpMyAdmin to manage it, select a table (in this example USER) and click on "Relation View", below the table's fields:

Now, from the foreign key field in the table USER (id_city) the field with which you want define the relationship, in this case id_city_pk in the CITY table:

Click on save to save created relation and repeat the action for all tables require relations. If you use an Access database, relationships can be defined from relationship view simply connecting with a mouse click two field.

How to define relationships using SQL I suggest to use always a separated file with SQL statements to create all database's tables and relationships between them. The code is very simple, easy to modify and to reuse. A relation is defined using the statement REFERENCES: 75


Issuu converts static files into: digital portfolios, online yearbooks, online catalogs, digital photo albums and more. Sign up and create your flipbook.