Jump to content

Recommended Posts

Ok, I am using phpmyadmin to create my MySQL data base and it is all working properly. I have normalised the data in my table and have all the feilds set up but I am unsure as to how I create the relationships butween the tables in my db. I know that in microsoft access all you do is open a window with the tables and drag the mouse over the fields you want to join, but I dont know how to do it in MySQL.

 

can anyone tell me?

Link to comment
https://forums.phpfreaks.com/topic/184-db-relationships/
Share on other sites

I might be wrong here and I am hoping I am becuase I\'ve been doing it this way for some time now...

 

There is no way to create a relationship between tables in MySQL. The relationships must be upheld through the code.

 

I believe they are planning to fix this as of MySQL 4

Link to comment
https://forums.phpfreaks.com/topic/184-db-relationships/#findComment-525
Share on other sites

table_name: cities

id | name

1 | charlotte

2 | new york

 

table_name: people

id | name | city

1 | bob | 1

2 | bill | 2

 

select p.name, c.name from cities c , people p where p.city=c.id;

(this is off my head - i may have something wrong but i hope you catch the general idea)

 

would return:

 

bob | charlotte

bill | new york

 

it returns the person\'s name and the city\'s name where the city field was equal to the cities id.

Link to comment
https://forums.phpfreaks.com/topic/184-db-relationships/#findComment-530
Share on other sites

  • 8 months later...

I have been searching the internet and books trying to find an actual explanation of how to query a DB using something along the lines of relationships. I\'m also an Access & Filemaker Pro user learning MySQL, and learning new terminology and structure is killing me!

 

Thank you Effigy for spelling it out for us converts!

 

:D:D:D:D:D

Link to comment
https://forums.phpfreaks.com/topic/184-db-relationships/#findComment-4669
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.