tags:

views:

14

answers:

1

Hi,

I would like to make a view, and in that view alter the tables to have foreign keys.

From the MySQL manual can I see, that foreign keys only work on InnoDB, but my database is MyISAM.

So my question is, is it possible to create a view, and then create foreign keys in that view?

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

+1  A: 

you have got everything completely wrong.,

first of all mysql allows you to use different table engines in a single table, so for example one table could be a myisam table and the other table could be an innodb table, it all depends on your need.,

the statement my database is myisam is completely wrong,.

secondly if you need for key constraints then use innodb tables and specify the constraints in the table definitions,.

you cannot specify foreign key constraints in views,. foreign key constraints are defined either when creating table or when altering the table.,

a view is something else,.

Views are stored queries that when invoked produce a result set. http://dev.mysql.com/doc/refman/5.0/en/views.html

ovais.tariq
Thank you very much for clearing that out! I'll dump the tables then, and change the engine to InnoDB on that, and then use foreign keys there.
thats nice to know,.
ovais.tariq