Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    Regular Coder
    Join Date
    Jul 2006
    Posts
    168
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Alter Table Type

    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?

    Ken
    Last edited by kenwvs; 08-28-2006 at 03:45 AM.

  • #2
    UE Antagonizer Fumigator's Avatar
    Join Date
    Dec 2005
    Location
    Utah, USA, Northwestern hemisphere, Earth, Solar System, Milky Way Galaxy, Alpha Quadrant
    Posts
    7,691
    Thanks
    42
    Thanked 637 Times in 625 Posts
    You sure can. What made you think you couldn't?

  • #3
    Regular Coder
    Join Date
    Jul 2006
    Posts
    168
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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.
    Last edited by kenwvs; 08-28-2006 at 08:31 AM.

  • #4
    Super Moderator guelphdad's Avatar
    Join Date
    Mar 2006
    Location
    St. Catharines, Ontario Canada
    Posts
    2,634
    Thanks
    4
    Thanked 148 Times in 139 Posts
    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.
    Last edited by guelphdad; 08-28-2006 at 01:09 PM.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •