flowingwindrider Posted July 26, 2007 Share Posted July 26, 2007 I'm having trouble learning to use foreign keys. Does anyone know of a good tutorial they could point me to? Quote Link to comment Share on other sites More sharing options...
effigy Posted July 26, 2007 Share Posted July 26, 2007 What kind of trouble? A foreign key is a key that points to another table. I found this from a Google search. Quote Link to comment Share on other sites More sharing options...
flowingwindrider Posted July 26, 2007 Author Share Posted July 26, 2007 I have a series of tables in a database, each one pertaining to a classified ad category. I need another table that groups all of their id's together in one place. Do I set the foreign keys in the new table to reference the others, or do I set the fk's in each table to reference the new one? Quote Link to comment Share on other sites More sharing options...
effigy Posted July 26, 2007 Share Posted July 26, 2007 Like this? Ad Categories =================================================== id | name 1 | Auto 2 | Home 3 | Pets Ads =================================================== id | cat_id | desc 1 | 3 | 2 yr. old hound. 2 | 1 | 1990 VW Bug. 3 | 2 | 4 bedroom somethingorother. In this case cat_id is the foreign key, which references Ad Categories' id. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.