I wish to have a foreign key in a table but I have no idea how to do it. I wish have a UserID Column in the “wall” table so that I can link back and get the userid’s details etc. How would i go about doing this?
Wall Table:
alt text http://img821.imageshack.us/img821/7701/screenshot20100808at010.png
Users Table:
alt text http://img375.imageshack.us/img375/7701/screenshot20100808at010.png
1) In order to have a foreign key column called
useridin theWALLtable, you need to create the column – skip to #2 if the column already exists:If you want to allow WALL records to exist without the userid being specified:
2) Now you add the foreign key constraint: