Link to home
Start Free TrialLog in
Avatar of manju70
manju70

asked on

how to create relationships in mysql using phpMyAdmin

Hai all,

I want to know how to create relationships between the tables in mysql using phpMyAdmin software.

Anyone who r familiar with it pls solve my problem

Thankyou
Manju

Avatar of Batalf
Batalf
Flag of United States of America image

mySQL doesn't support physical relations between tables. It only support the syntax(create table.....references) to make it easy to transfer a db from an other db-system to mySQL.

But: mySQL is still a relational database management system(RDBMS), but the relations between tables are not physical. If I have 2 tables

"score"
ID int
studentID int
score varchar(5)

and the table "student"
ID int
firstname varchar(32)
lastname varchar(32),

they stand alone without a physical connection. But with the studentID in the table score I have constructed the tables as if there were a physical relation between them, and I could use SQL-querys as in other DB_systems.
Avatar of manju70
manju70

ASKER

At first I thank, for your comments.
but, if I wanted to load data in a foreign key field then how am I to ensure whether the corresponding primary key field is available in master table(like in Ms access ).

if mysql doesn't supports this features,is any other free software which supports it is available?????

thanks in advance
manju
If you have two tables:

users
~~~~~
userID
username
password

demographics
~~~~~~~~~~~~
userID
age
sex
race

Your SQL query would be:  "select * from users, demographics where users.userID=demographics.userID" to get the data from both tables

but, if I wanted to load data in a foreign key field then how am I to ensure whether the corresponding
primary key field is available in master table(like in Ms access ).


You should be using JOINS to do this.

My friend esnagel has suggested you how do to same using LEFT JOIN.

But if you want more features Try PostGRE SQL.

http://www.at.postgresql.org/

JD
ASKER CERTIFIED SOLUTION
Avatar of Zuhair070699
Zuhair070699

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Zuhair

thats heck of a software !!!
JD