I mean a category table. Because a category is something you want to store information about. The category name, mostly, but if, lets say, later on, you wanted to put a sale on certain categories of your store. You could have a field in your category table for ‘discount’.
A database is not a single table, unless you’re modelling something very, very basic.
The idea is to remove redundancy and overhead. For example. Let’s take some products, and their categories, and…lets say their price… and the current discount i’m giving out.
Product, Category, Price, Discount
iPhone,Phones,300,0
Motorola i231,Phones,300,0
Tshirt,Apparel,12,5
Sweatshirt,Apparel,22,5
etc etc etc.
(I’m having a 5$ sale on apparel.)
Now, I COULD store all that in a single table. But it’s highly wasteful to save the word “Apparel” in the database over and over and over… and that’s assuming of course that you never ever maek a typo, because then you’d break your pretty groupings.
Instead, how about I do this…
Product,Category,Price
iPhone,1,300
Motorola i231,1,300
Tshirt,2,12
Sweatshirt,2,22
Categoryid,Categoryname,discount
1,Phones,0
2,Apparel,5