Forum Moderators: coopster

Message Too Old, No Replies

Mysql question...is it better to have

         

Acternaweb

1:46 pm on Dec 19, 2003 (gmt 0)

10+ Year Member



1 table with many fields (10-12) or have many tables with each table have few fields (4-6 at most).

Is it true that each table should have an ID as a field?

ukgimp

2:06 pm on Dec 19, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Database mormalisation [devshed.com]

Your circumstances will dictate what you end up doing.

coopster

2:07 pm on Dec 19, 2003 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



It is going to depend on the data you are storing and how you intend to manage the data (access for insert/update/delete as well as select/search and display). As far as fields go, 10-12 is relatively small. If you want to give us an idea of what you are looking at, we can offer direction...

>>Is it true that each table should have an ID as a field?

Are you referring to a PRIMARY KEY?

Acternaweb

2:28 pm on Dec 19, 2003 (gmt 0)

10+ Year Member



I am trying and I use that word losely to create a db to organize my sports collection. I have my attempt at a schema and would really appreciate any feedback and advice on setting up my db.

Let me know whatelse would be helpful for your expertise?

Yes, in access each table has a key that is automatically generated.

Insert/update/delete - yes for me only

as well as select/search and display - yes for everyone

ergophobe

4:44 pm on Dec 19, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



In short, yes, you probably want an auto increment id field where id is unique.

The important thing is for each table to have a primary key that creates unique records. For example, you may have two people named John Smith, so you don't want to depend on names to ensure that each record is unique.

The primary key may, however, be compound. For example, if you have a database for cars that only tracks models, the primary key could consist of model_year, make and model_name. You might have many cars from 2003 and many Hondas, many Accords, but you will only have one 2003 Honda Accord.

Tom