Brendon_vbulletin3_import12785
New Member
Firstly I want to thank all of you who have helped me understand Normalization and how I should build up my database.Now, I have some final issues left...How does LINKING of tables actually work?Say you have three tables:\[code\]CATEGORY TABLE:cat_id (PK) -> 1cat_name -> carsCATEGORY_OPTIONS TABLE:cat_opt_id (FK) -> 1cat_id (FK) -> 1option_name -> yearCATEGORY_OPTIONS_VALUES TABLE:cat_opt_val_id (PK) -> 1cat_opt_id (FK) -> 1value -> 1999\[/code\]Basically, the values should look like this:\[code\]CATEGORY(1, cars)(2, MC)CATEGORY_OPTIONS(1, 1, year)(2, 1, fuel)(3, 2, type)CATEGORY_OPTIONS_VALUES(1, 1, 2010)(2, 1, Petrol)(3, 2, Cross)\[/code\]Is this correct as I have it setup above?How would I search these, how is the logic made up?I think I need examples of queries from PHP (SELECT etc)Say you want to search for a CAR -> year=2010, fuel=PETROL how is the query then?AND SAY you want to search for a CAR -> fuel=PETROL, year=anythingLASTLY, should I use AutoIncrement on any of these fields? And when is AI used?ThanksPS: For more info, check out this Q:http://stackoverflow.com/questions/2100008/can-this-mysql-db-be-improved-or-is-it-good-as-it-is