Mohammad Karimi
Mohammad Karimi

Reputation: 33

use a type column or separate type table in database design?

I have a category table. Each category has a type. I have 3 idea for type:

  1. Use a type table and use a type_id column in category(foreign key to id of type table). Image of idea 1
  2. Use a type table and name in type is primary key and in category typ_name(string) is primary. In this idea I don't need join for get type name. Image of idea 2
  3. Use a type column in category and don't use a separate type table(I think it is not good). Image of idea 3

Upvotes: 1

Views: 1274

Answers (1)

You should go with the first option because of the following things:

  • It is easier to extract data from that approach
  • Data will be normalized
  • You can easily distinguish between things of different category
  • Easier for even a lay man to understand

Upvotes: 1

Related Questions