I start new e-commerce web application (pet project) that purchase both t-shirt and shoe. My store only has free size Tee shirt is often a tendency-shirt only has color column while shoe has posts for size and color.

Now you have to produce table to keep that data, I wish to know could it be good to produce separate table for shoe and t-shirt or it's easier to keep these in a single table?

If it features a better idea to keep such data, please tell me.

Have them all-in-one table and also have a type area. The main reason to get it done by doing this is to ensure that your computer data structure is scalable: i.e. if there's a brand new kind of product then rather than adding a brand new table and needing to drastically improve your application code, you simply make use of the same table and just give a type.

You certainly don't wish to produce a Shoe table along with a TShirt table. Your shop might grow, and something day you will have a 1000 such product tables. Writing SQL for your will be a nightmare. Plus, you may have different types of t-t shirts eventually, some with color, some with size and color, and so forth. Should you produce a new table for every, you'll forget them rapidly, and when you do not, why have separate tables for t-t shirts and footwear, although not for just one-size t-t shirts and multi-size t-t shirts?

While creating your database, you ought to be wondering: do you know the organizations during my realm? do you know the stuff that never change and therefore are distinctively identifiable? Inside a shop, a specific item that may be offered in a particular cost is a such entity. So you may possess a items table which has a key for every particular item you sell, and perhaps a title, a kind, a size along with a color column:

 id | type | name     | size  | color
 1  | shoe | Marathon | 9     | white
 2  | shoe | Marathon | 9     | black

Searching only at that table, you see that people have two records for that highly effective Marathon running footwear, which appears to become a normalization breach. Indeed, you most likely have two organizations a shippable item along with a catalog product. The shoe "Marathon" is most likely something which has one picture and something description inside your store, then a "obtainable in the next colors and dimensions:" line. So now you must two tables:

id | type   | name        | supplier        | picture      | description
1  | shoe   | Marathon    | TrackNField Co. | marathon.jpg | Run faster than light!
2  | tshirt | FlowerPower | SF Shirts       | fpower.jpg   | If you're going to San Francisco...

id | product_id | size | color | price
1  | 1          | 9    | white | 99.99
2  | 1          | 9    | black | 99.99
3  | 2          |      | blue  | 19.99

The "type" column within the product table could be a tricky one. You'll most likely wish to display items by category, allow the user click "footwear" and obtain all items with type "shoe". Easy to date, but eventually someone will mistype an entry "sheo", and you aren't able to find that product under footwear any longer. Therefore it is easier to separate the categorization in the items, for instance by getting an item_type table:

id | name
1  | shoe

id | type_id   | name        | supplier        | picture      | description
1  | 1         | Marathon    | TrackNField Co. | marathon.jpg | Run faster than light!

having a mention of enter in the product table. That's ok as lengthy as the type hierarchy stays shallow, but what if you wish to have subcategories, like "sneaker", "basketball shoe", "suede shoe", and so forth? One shoe could even fit in with a number of these subcategories. For the reason that situation you can test this

id | name         | supercategory_id
1  | shoe         |
2  | running shoe | 1

product_id | category_id
1          | 2

id | name        | supplier        | picture      | description
1  | Marathon    | TrackNField Co. | marathon.jpg | Run faster than light!

And when you need to display multiple hierarchies of categorizations (since many large ecommerce sites do nowadays), you will need to develop something much more sophisticated.