views:

34

answers:

1

I want to create two Tables. Product, Members, and Category. I want the structure of the tables to be like:

Category: Two Fields: (Category_ID) (Category_Name) and I would like Category_ID to be the Primary Key

Product: Three Fields (Product_ID) (Product_Name) (Product_Price),(Category_ID) and I would like Product_ID to be the Primary Key, and Category_ID to be the Foreign Key.

I have been working at this for hours and I keep getting a constraint error. If someone would be willing to show me the SQL statements they would use in my situation, that would be great.

A: 

If you're using phpMyAdmin you can do it all with the GUI. And once you've created your tables with the GUI, you can look at the SQL it used to create them, or the alter statements it used to create the PK / FK constraints.

Tim