sql needed for adding foreign keys

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
User avatar
raghavan20
DevNet Resident
Posts: 1451
Joined: Sat Jun 11, 2005 6:57 am
Location: London, UK
Contact:

sql needed for adding foreign keys

Post by raghavan20 »

I forgot to create foreign keys during the creation of tables and i want to add foreign keys now.

I want the syntax format for one instance so that I can build for others

two tables: Members_tbl, UserAccounts_tbl
both have got MemberId field
and Members_tbl.MemberId references UserAccounts_tbl;

how to put all of these together as a sql stmt?
timvw
DevNet Master
Posts: 4897
Joined: Mon Jan 19, 2004 11:11 pm
Location: Leuven, Belgium

Post by timvw »

Do a websearch on "sql alter foreign key".

http://dev.mysql.com/doc/mysql/en/innod ... aints.html
Post Reply