Creating Foreign Key using phpMyAdmin
Posted: Thu Nov 09, 2006 9:54 am
Hello,
I usually use SQL syntax when creating a foreign key. Today, I want to learn using phpMyAdmin.
Now, I have two tables for example, namely tbladdress and tbluser.
in tbladdress, there is userID field. And usually, using SQL syntax I would do something like this in the tbladdress while creating the table using SQL:
Refer to the REFERENCES...
Using phpMyAdmin I created the tables. And while creating tbladdress I choose userid INT UNSIGNED NOT NULL using the GUI...but I am not sure that it's referenced to field userid within the tbluser ?? How do I know that it's referenced already ?
Thanks,
Chris
I usually use SQL syntax when creating a foreign key. Today, I want to learn using phpMyAdmin.
Now, I have two tables for example, namely tbladdress and tbluser.
in tbladdress, there is userID field. And usually, using SQL syntax I would do something like this in the tbladdress while creating the table using SQL:
Code: Select all
CREATE TABLE tbladdress (
addressID INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY
userID INT UNSIGNED NOT NULL REFERENCES tbluser(userid)
);
Using phpMyAdmin I created the tables. And while creating tbladdress I choose userid INT UNSIGNED NOT NULL using the GUI...but I am not sure that it's referenced to field userid within the tbluser ?? How do I know that it's referenced already ?
Thanks,
Chris