Is there any alternative way to use foreign keys in MyISAM tables?

2

I'm making an application and I need to relate two tables logically, I could use foreign keys ... The problem is that the database I'm using only allows MyISAM tables that does not support foreign keys like InnoDB. So, how could you work around this problem without having to use InnoDB tables?

    
asked by anonymous 26.03.2014 / 14:38

1 answer

2

Foreign keys in MySQL are used to check and guarantee referential integrity , not to join between tables.

The only alternative is to be doing the work than is done by the database to ensure referential integrity .

However, you can continue to join between related tables through these columns, just as you do in the case of foreign keys.

that is:

SELECT * FROM tabell1 INNER JOIN tabela2 ON tabela1.id = tabela2.id;  

is still valid

    
26.03.2014 / 15:11