Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
235 views
in Technique[技术] by (71.8m points)

sql - How to create db table structure to capture and process items used in food-bank deliveries/orders

This is a business process driven question rather than a code specific one. I’m learning to use SQL to help support a local food-bank. I need to design a set of tables within the dev db which enables me to calculate and report on the number of items used in the boxes (and bags) collated by the foodbank for any delivery session.

Details are as follows:

  • Grocery/Inventory items are classed as groups: ‘tin beans’, ‘pasta’, tin fruit’, etc. There are presently 25 similar categories and are listed in a ‘store items’ table. This is the lowest level of grain for the db, analysis and reporting.
  • Grocery items are collated into a box. Each box holds 17 items.
  • There are 5 different box types - each have different mixes selected from the 25 store items.
  • For each session, X boxes may be collated, with each of A,B, C etc types being used.
  • So, for each session a simple view is needed which lists the volumes of grocery items (store items) used in all the boxes collated.
  • This view is then to be used to update a high level ‘current stock’ position...to which new donations are added (this part of the db and processing is already built and being tested).

Another way of looking at it may be as how to work out the shopping list of ingredients for a cafe with various dishes on the menu!

I’m building in Azure using SSMS and T-SQL. It is basic as is my current understanding of T-SQL! How can I simply solve this problem in terms of the db table structures, relationships and any particular code instructions that I may need to use in scripts or stored procedures? I've looked into arrays but not sure if this is the answer (ie box type against items).

Thanks!

question from:https://stackoverflow.com/questions/65939696/how-to-create-db-table-structure-to-capture-and-process-items-used-in-food-bank

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...