Jump to content

db relationships


im1hunt

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.