Solved

how to create relationships in mysql using phpMyAdmin

Posted on 2002-03-14
6
5,108 Views
Last Modified: 2010-08-05
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

0
Comment
Question by:manju70
6 Comments
 
LVL 32

Expert Comment

by:Batalf
ID: 6867893
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.
0
 

Author Comment

by:manju70
ID: 6868432
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
0
 

Expert Comment

by:esnagel
ID: 6870102
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

0
Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

 
LVL 5

Expert Comment

by:dkjariwala
ID: 6870559
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
0
 

Accepted Solution

by:
Zuhair070699 earned 30 total points
ID: 6876027
I am using Mysql Manager program to do relationships between tables.

You can download full function 30 day trial version from here:

http://ems-hitech.com/mymanager/download.phtml
0
 
LVL 5

Expert Comment

by:dkjariwala
ID: 6876049
Zuhair

thats heck of a software !!!
JD
0

Featured Post

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Popularity Can Be Measured Sometimes we deal with questions of popularity, and we need a way to collect opinions from our clients.  This article shows a simple teaching example of how we might elect a favorite color by letting our clients vote for …
Introduction This article is intended for those who are new to PHP error handling (https://www.experts-exchange.com/articles/11769/And-by-the-way-I-am-New-to-PHP.html).  It addresses one of the most common problems that plague beginning PHP develop…
The viewer will learn how to count occurrences of each item in an array.
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

776 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question