Jump to content

[SOLVED] Relationships in MySQL


LiamH

Recommended Posts

Hi again all.

 

In SQL Server for example, if you have 2 tables that have a relationship together, you use Reference to make this relationship. Is there anything in MySQL that does the same thing? I am aware of JOIN, but I understand this is just for joining data when running a SELECT statement?

 

Thanks

Link to comment
https://forums.phpfreaks.com/topic/144809-solved-relationships-in-mysql/
Share on other sites

I do know the table type has to be InnoDB for this functionality.

 

http://dev.mysql.com/doc/refman/5.1/en/innodb.html

 

For usage on creating the tables to link to each other:

http://dev.mysql.com/doc/refman/5.0/en/innodb-foreign-key-constraints.html

 

 

Thanks a lot. I thought there would be something, but the books I have for some reason don't mention REFERENCE

 

It very well could be they were writing it designed for Mysql 3.x, and in that version InnoDB was not enabled by default.

 

That and really a lot of people disregard that cause it makes it a "headache" for some stuff to do.

 

Doing it without the relationship makes stuff a bit simpler when it comes to some tasks, when it comes to others, such as removing a whole section and having it cascade down it makes it a ton easier.

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.