I need advice how to structure database for storehouse management with C# MySQL Server -


this question focused on getting idea how structure database. there not going code posted. please don't mark questions "too broad" since case specific , need answer specific case.

i trying make software managing stores. lets have storehouse can keep lots of products different types. lets focus on types tech (laptops, mobile phones, pcs) , clothes ( jackets, dresses, shoes).

i have different sections in storehouse storing tech products , clothes. since have lots of different types of products , think 1 table wont satisfy needs. if create new table every type need hold products location. means have lots of tables check products when collecting data storehouse , doesnot seem best solution.

if use mongodb create 1 table product , not worry since can add properties wish , have collection called storehouse sections have products. in mysql database don't think having big tables lots of properties best solution.

the biggest problem have full freedom create database see fit long mysql server. don't have physical storehouse. project uni need create software if had one. meaning can have many sections wish , many product types wish. freedom means there lots of options me create database none seem effective.

should create different tables every category , store products there? should have 1 table basic information (picture, name, description, price) , in others based on id hold rest of information? should have different sections individual tables , 1 table storehouse hold every section? should create less tables more compacted or separate lots , lots of tables , relations between them?

what looking advice on how make following best practices. thank in advance!

and last - please don't mark broad because think isn't. if - please leave comment explain why think is.

i'm going share insight though first instinct vote close question. stackoverflow isn't place conceptualizing system. strictly speaking, should have of kind of stuff worked out before come , ask here, , then, codereview better place once have code written up.

so way see it, you'll want @ least 3 tables (categories, subcategories, products).

  • categories table "clothes", "tech", etc.
  • subcategories table "jackets, dresses, shoes" etc".
  • products actual product detail.

to link data, you'll have column reference record in other table similar this:

categories table:     integer column "id" - primary key, not allow nulls     varchar column "name" - not allow nulls  subcategories table:     integer column "id" - primary key, not allow nulls     integer column "categoryid" foreign key references categories.id, not allow nulls     varchar column "name" - not allow nulls  products table:     integer column "id" - primary key, not allow nulls     integer column "subcategoryid" foreign key references subcategories.id, not allow nulls     <the rest of product information goes here> 

you add category column products table should specify subcategory. allow filter products category , subcategory both.

this approach simple can please next time try before ask.


Comments

Popular posts from this blog

networking - Vagrant-provisioned VirtualBox VM is not reachable from Ubuntu host -

c# - ASP.NET Core - There is already an object named 'AspNetRoles' in the database -

ruby on rails - ArgumentError: Missing host to link to! Please provide the :host parameter, set default_url_options[:host], or set :only_path to true -