View Full Version : Alter Table Type
08-28-2006, 04:36 AM
I am trying to alter my table type so I can use a foreign key.
I am using this command and it says it is updated, but the table type doesn't atually change. Do I need to recreate my tables, starting out with this type of table?
ALTER TABLE employees TYPE = innodb;
Even when I creae a table, it doesn't give me the option of what kind of table type. I am using phpmyadmin to manage my DB.
EDIT: I just did some research and found that my service provider doesn't offer innodb as an option. Is it still possible to set up my tables with a foreign key to link my various tables together?
08-28-2006, 05:43 AM
You sure can. What made you think you couldn't?
08-28-2006, 08:11 AM
I must be misunderstanding what I am reading as I got the impression that to do this you needed to have this type of table. I am not seeing how I can define the column in my table as a foreign key (my database type is MyISAM)
I am quickly learning that when using PHP and databases, things are never as simple as they first seem.....:) but it is still exciting and feels good when something works at the end.
Back to the net and reading some more and figuring out how to tie the related columns together to make this all work. Is there a tutorial that will show how to tie this all together and what the php portion would look like. I am not sure which table (now that there are several) I would want the data to go to. If I understand this correctly, when it is working properly, it will take bits of information from different tables and compile the end result. I am not sure I am following all of this and would love to know of a tutorial that starts with the basics and moves on from there. I have read the article available in resources on this site.
08-28-2006, 11:34 AM
you can declare a foreign key using any type of table. however only innodb will enforce it.
Say you have a parent table and have a list of customer ids. in the secondary table you create a foreign key to that column.
in innodb you can't insert a customer id in the customerid field that doesn't exist in the parent table. with myisam you can because it does not enforce the foreign key, though it lets you create it.
Powered by vBulletin® Version 4.2.2 Copyright © 2015 vBulletin Solutions, Inc. All rights reserved.