hi everyone,
I'm building a database for stock management, all the incoming supply that I get from every supplier goes into one table, and of course the sales I make goes to other table.
Say I'm selling a products package that includes some products, so for that I create a table which includes the packages name; let's say I'll call this one tbl_packages.
I also created another table that includes the content of every package, called tbl_packages_content; these tables are linked by packages ID from tbl_packages table.
These packages contain default products, but let's say I want to have the option to combine some products different then the other packages and I don’t want to do it by adding a new package to the tbl_packages table since I'll use it only once.
As I said before the goal is stock managing, this means that I want to be able to subtract the ordered products from in stock products, in order to know my stock condition.
My question is what will be the best way to build it, since I don't have experience in database building.
Here's my idea but I'm really not sure:
tbl_packages - contains the name of packages.
tbl_packages_content - contains the products within each package, linked to tbl_packages.
tbl_client_order_details – contains the sum of ordered packages for each order.
The aforementioned tables are in charge of the default packages, for the costume packages I'll create other table, called tbl_costume_packages. The information in this table will refer to the products only without categories them as any type of package.
After that I'll create a query which will sum all the products from tbl_client_order_details, this query will also find the sum of the products from tbl_costume_packages, and then I'll subtract this amount from the in stock table.
As I mentioned before I'm new to DB designing, so if anyone can help me to see things brighter in order to create the right design I'll appreciate it.
thank's
I'm building a database for stock management, all the incoming supply that I get from every supplier goes into one table, and of course the sales I make goes to other table.
Say I'm selling a products package that includes some products, so for that I create a table which includes the packages name; let's say I'll call this one tbl_packages.
I also created another table that includes the content of every package, called tbl_packages_content; these tables are linked by packages ID from tbl_packages table.
These packages contain default products, but let's say I want to have the option to combine some products different then the other packages and I don’t want to do it by adding a new package to the tbl_packages table since I'll use it only once.
As I said before the goal is stock managing, this means that I want to be able to subtract the ordered products from in stock products, in order to know my stock condition.
My question is what will be the best way to build it, since I don't have experience in database building.
Here's my idea but I'm really not sure:
tbl_packages - contains the name of packages.
tbl_packages_content - contains the products within each package, linked to tbl_packages.
tbl_client_order_details – contains the sum of ordered packages for each order.
The aforementioned tables are in charge of the default packages, for the costume packages I'll create other table, called tbl_costume_packages. The information in this table will refer to the products only without categories them as any type of package.
After that I'll create a query which will sum all the products from tbl_client_order_details, this query will also find the sum of the products from tbl_costume_packages, and then I'll subtract this amount from the in stock table.
As I mentioned before I'm new to DB designing, so if anyone can help me to see things brighter in order to create the right design I'll appreciate it.