Jump to content

Best way to set up table(s) when multiple values


Recommended Posts

Should be a fairly simple question.


I want to set up a fairly simple database with company information (name, email contact etc.) and the category or categories they serve. Companies in the table may be associated to one category or may be associated with 3 or 4. Should I make another table for categories (and if so how would keys be set?) or just have it in the one table?


Having a programmer link it all up and stuff, it's not my area, but would like to just have the tables set up and ready.

Link to comment
Share on other sites

I gave an answer to a very similar question earlier




I seen that thanks... so the categories table would I just have one row for id (what kind of key should I make id on this table and the id on the business table?) and one row for category?


My business table looks like this:


id smallint(6) auto_increment

business varchar(50)

contact varchar(50)

email varchar(100)

phone varchar(20)

address varchar(125)

city varchar(20)

postcode varchar(20)

description text


Also, the collation seems to default at "latin1_general_ci" is this normal/ok/matter?

Edited by Mal1
Link to comment
Share on other sites

I recommend looking up on "Database normalization", starting with this video series:


It should help explain how to properly design a database, or at least get you started on it.


As for the collation/charset: Latin1 works, but UTF-8 is recommended as it allows you to store any character without jumping through hoops.

Link to comment
Share on other sites

This thread is more than a year old. Are you sure you have something important to add to it?

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.