Hi I am trying below ===================================================================== TO ADD A FOREIGN KEY TO AN EXISTING TABLE (I couldn't see a good example) you can do this:
alter table users add foreign key(favGenre) references products_genre (gid); Where favgenre is the column of the table that has the foreign key and products_genre(gid) is the table and primary key you are referencing. ====================================================================== I want to add foreign key to projecttype_table in project_table mysql> desc projecttype_table; +------------------+-------------+------+-----+--------- +----------------+ | Field | Type | Null | Key | Default | Extra | +------------------+-------------+------+-----+--------- +----------------+ | id | int(11) | NO | PRI | NULL | auto_increment | | projecttype_name | varchar(50) | YES | | NULL | | +------------------+-------------+------+-----+--------- +----------------+ mysql> desc project_table; +--------------------+--------------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +--------------------+--------------+------+-----+---------+-------+ | project_status | int(11) | YES | | NULL | | | customer_name | varchar(255) | YES | | NULL | | | cust_org_id | int(11) | YES | MUL | NULL | | | sap_code | varchar(75) | NO | PRI | NULL | | | project_name | varchar(100) | YES | | NULL | | | planned_start_date | date | YES | | NULL | | | planned_end_date | date | YES | | NULL | | | project_manager | varchar(50) | YES | MUL | NULL | | | domain | int(11) | YES | MUL | NULL | | | language_id | int(11) | YES | MUL | NULL | | | techonology_id | int(11) | YES | MUL | NULL | | +--------------------+--------------+------+-----+---------+-------+ --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "symfony users" group. To post to this group, send email to symfony-users@googlegroups.com To unsubscribe from this group, send email to symfony-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/symfony-users?hl=en -~----------~----~----~----~------~----~------~--~---