How to structure a variable product rating database

JenniferMurphy

Well-known Member
Joined
Jul 23, 2011
Messages
2,687
Office Version
  1. 365
Platform
  1. Windows
For many years I have more or less kept track of how much I liked various products, usually with a rating on a 0-100 scale where 0-20 is terrible, 20-40 is poor, 40-60 is average, 60-80 is good, and 80-100 is excellent. This method sorta works, but it has some serious limitations. For some time I have been meaning to get up to speed with Access so I can do this in a database.

I am now ready to give this a try, but I have run into an immediate design question. I understand the basic database concepts of tables, records (rows), fields (columns), primary keys, foreign keys, relationships (1-1, 1-many, many-many), queries, forms, and normalization. What I need help with is how to design the tables and relationships for this application.

I would like a single database for all, or almost all, of the products that I use and want to rate. This would include food, household supplies, clothing, medications, etc. The problem I am having is that these products have very different properties. Here are some examples of products that I have in one of my Excel workbooks with the properties for each.

1710132430658.png


These are the tables that I think I will need to start:
  1. Vendors. It will contain all of the places where I buy things: Amazon, Safeway, CVS, ...
  2. Products. I am not sure if this is a table on its own or the result of one or more junction tables.
  3. Purchased. One record for each purchase of each product.
  4. Ratings. One record for each time I rate a product.
I am sure there will be other tables and some junction tables for the many-to-many relationships (e.g. Products-Vendors).

I don't know what to do about the brands, flavors, colors, styles, etc. I need a way to "connect" specific properties to specific products.

I see 2 forms I need to start:
  1. New Product Form. It will allow me to add a product. It will probably need a sub-form to allow me to add types and properties.
  2. Rating Form. It will allow me to rate an existing product.
I see 1 report I need at first:
  1. Display a list of specific types of products that can be filtered by product type and sorted by rating, date last purchased, etc.
I would appreciate suggestions for how to set up the tables and relationships. I need way to tell Access which properties are applicable to each product.

Please let me know if this wasn't explained clearly.

Thanks
 

Excel Facts

Wildcard in VLOOKUP
Use =VLOOKUP("Apple*" to find apple, Apple, or applesauce
There's going to be more than one way to arrange things and it always depends on what you want to get from the table.

How far down the properties list will you go? If you buy raisins, would you list origin and color? If you bought Oats, would you itemize the list of subtypes? Flour? Sugar?
At what stage of the process do you describe all the properties? Do you want to have to pick from a list describing all the properties or freeform add them as you purchase? aka, pick from a list but add more if needed?

You have to think about your relationships.
I'd lean towards one of the star schema patterns. At the most basic level, you'd have the common facts sitting in the middle of multiple dimensions around the perimeter.
It's extremely common to have multiple fact tables in what's often termed "extended".

Your fact table would likely focus on the purchases. You'd have a date (even though you could also use a date dimension) with references outward to the Vendor, Specific Products and Ratings.
While you could use plain text descriptive terms for the values in the fact table, this design lends itself towards a some sort of numeric (or alphanumeric) index value where the plain text names are in the dimensions "around" the center.

I'd ask a question about things like ratings. Are you likely to rate each individual purchase of each specific item (or not) - however you decide changes how you can design the relationships. If the item purchased on mm/dd/yyyy has a rating that could be different from any other identical purchase, you might put the rating into the fact table itself. If each item only has one rating, you might put it into the product description table.

Oh, incidentally, the way you want to record the properties of an item is in it's own table.
You'd have an index, the name of the property and the value (as the 3 columns).

Mike
 
Upvote 0
Mike,

I have to apologize. I am working on two related projects. This one is for evaluating products already purchased. It is the simpler project. The other one is for evaluating products prior to purchase. That is one that focuses more on the individual properties and is the one that my misplaced comments about properties in this thread refer to. I got them mixed up. Sorry about the confusion.

Here's a mini-sheet for one of my product rating sheets. I think it gives a very good sense of what the database for this project should cover. This one is for soup.

The table on the left (TblProducts) has one record for each of the products that I have purchased. Most of the columns are calculated and not table fields. I would probably have another table (TblPurchases) to record each purchase showing the date, the price, and the store.

The table on the right (TblLog) has one record for each time I tried a product and recorded a rating.

I think this should be a fairly straightforward database application. Do you agree?

Product comparison, Food.xlsx
BCDEFGHIJKLMNOPQ
3Product TableUsage Log Table
4BrandFlavorDup?CountAvg RtgHigh RtgLow RtgFirstLastDateOK?BrandFlavorRatingComments
5ProgressoChicken & Homestyle NoodlesOk490.395.087.010/29/233/15/243/15/24OkProgressoChicken & Homestyle Noodles95
6ProgressoItalian-Style WeddingOk286.092.080.010/16/232/10/243/11/24OkProgressoChicken & Homestyle Noodles92
7ProgressoCreamy Chicken & Homestyle NoodlesOk183.083.083.012/29/2312/29/233/09/24OkProgressoHomestyle Chicken with Vegetables & Pearl Pasta70Odd aftertaste
8ProgressoChicken NoodleOk182.082.082.06/28/236/28/233/04/24OkCampbell'sPub Style Chicken Pot Pie60Not great
9ProgressoHearty Chicken Pot Pie Style with DumplingsOk279.080.078.012/11/2312/18/232/22/24OkProgressoItalian Sausage & Potato85Good as a side to a potato
10ProgressoHomestyle Chicken with Vegetables & Pearl PastaOk278.587.070.02/11/243/09/242/18/24OkProgressoItalian Sausage & Potato40To spicy
11Campbell'sChunky Chicken NoodleOk176.076.076.05/25/235/25/232/11/24OkProgressoHomestyle Chicken with Vegetables & Pearl Pasta87Very good
12Amazon KitchenChicken NoodleOk175.075.075.010/29/2310/29/232/10/24OkProgressoItalian-Style Wedding92Very good & filling, could make 2 meals
13Amy'sThai CoconutOk175.075.075.08/18/238/18/232/08/24OkProgressoLasagna-Style Soup with Italian Sausage75A little too spicy
14Campbell'sChunky Chicken and Sausage GumboOk175.075.075.03/04/233/04/232/03/24OkProgressoChicken & Homestyle Noodles87Maybe better for 2 meals
15ProgressoLasagna-Style Soup with Italian SausageOk175.075.075.02/08/242/08/241/29/24OkCampbell'sChunky Creamy Chicken Noodle60Odd aftertaste
16Amazon KitchenNew England Clam ChowderOk170.070.070.010/29/2310/29/231/11/24OkProgressoCreamy Mushroom70Ok for half a can
17ProgressoCreamy MushroomOk170.070.070.01/11/241/11/2412/29/23OkProgressoCreamy Chicken & Homestyle Noodles83Fairly good
18ProgressoItalian Sausage & PotatoOk262.585.040.02/18/242/22/2412/18/23OkProgressoHearty Chicken Pot Pie Style with Dumplings78Not great
19Campbell'sChunky Creamy Chicken NoodleOk160.060.060.01/29/241/29/2412/11/23OkProgressoHearty Chicken Pot Pie Style with Dumplings80Good, but not great
20Campbell'sPub Style Chicken Pot PieOk160.060.060.03/04/243/04/2410/29/23OkAmazon KitchenChicken Noodle75Ok
21Campbell'sChunky Beef with VegetablesOk140.040.040.03/04/233/04/2310/29/23OkAmazon KitchenNew England Clam Chowder70Tastes pretty good, but clams very chewy
22Amy'sBlack Bean VegetableOk125.025.025.09/26/239/26/2310/29/23OkProgressoChicken & Homestyle Noodles87Very good
2310/16/23OkProgressoItalian-Style Wedding80Good, but not great
249/26/23OkAmy'sBlack Bean Vegetable25Yukky
258/18/23OkAmy'sThai Coconut75Ok
266/28/23OkProgressoChicken Noodle82Pretty good
275/25/23OkCampbell'sChunky Chicken Noodle76Needs a little salt
283/04/23OkCampbell'sChunky Beef with Vegetables40The cook-in-package is junk
293/04/23OkCampbell'sChunky Chicken and Sausage Gumbo75A little too spicy
Soup
Cell Formulas
RangeFormula
D5:D22D5=IF(COUNTIFS([Brand],[@Brand],[Flavor],[@Flavor])=1,"Ok","Dup")
E5:E22E5=COUNTIFS(TblLog[Brand],[@Brand],TblLog[Flavor],[@Flavor])
F5:F22F5= IF([@Count]>0,AVERAGEIFS(TblLog[Rating],TblLog[Brand],[@Brand],TblLog[Flavor],[@Flavor]),"n/a")
G5:G22G5= IF([@Count]>0,MAXIFS(TblLog[Rating],TblLog[Brand],[@Brand],TblLog[Flavor],[@Flavor]),"n/a")
H5:H22H5= IF([@Count]>0,MINIFS(TblLog[Rating],TblLog[Brand],[@Brand],TblLog[Flavor],[@Flavor]),"n/a")
I5:I22I5= IF([@Count]>0,MINIFS(TblLog[Date],TblLog[Brand],[@Brand],TblLog[Flavor],[@Flavor]),"n/a")
J5:J22J5= IF([@Count]>0,MAXIFS(TblLog[Date],TblLog[Brand],[@Brand],TblLog[Flavor],[@Flavor]),"n/a")
M5:M29M5=IF(COUNTIFS(TblProducts[Brand],[@Brand],TblProducts[Flavor],[@Flavor])=1,"Ok","Error")


Regarding the other project, your comment about star schemas was very helpful. I'll read up on "star schemas" and "snowflake" schemas. Thanks
 
Last edited:
Upvote 0
Quick question. Is it an option to use any BI type software? Conditional counting is a very common use item in products like Tableau and PowerBI.
So anytime you need to do calculations in a final result, in nearly all cases, you want to use a view/query to do that and not store it as a table value unless it's truly static and a final value.

If you were working in SQL, partitions strike me as the easiest way to do that kind of calculation or possibly CTE's. As Access doesn't support either,
What I'd suggest for you is you use the QBE wizard (query by example) and look at both of the standard offerings - "Find Duplicates" and "Find Unmatched" and see how they work.
The next thing is, subqueries. In Access, as far as I know, you can use CTE's in an external SQL statement (such as targeting SQL server) but you can't, inside MS Access. You can, however, make a distinct query and then join it to your base table. This is how you can replicate what partitions can do.

Partitions are a way of taking the base data (as written in the FROM segment) and then aggregating to produce a calculation for only a segment of the data.

SELECT A.COL1, B.COL2
,B.COL3
FROM A
JOIN B ON A.COL1 = B.COL1

Table B is going to be something like:

SELECT B.COL1
,B.COL2
,SUM(B.COL3) AS COL3
FROM B
{WHERE PARAMETER CAN BE HERE}
GROUP BY
B.COL1
,B.COL2
{AGGREGATION HAVING CAN BE HERE}

Summarizing, you will have your base table. Anything that's calculated that also looks at the entire table to get an average may need it's own GROUP BY type of query to do that possibly conditional aggregation. Functions like min/max/average are all available. If you need to get the first entry, make sure you add an ORDER BY clause because you can never rely upon tables to know which is first without explictly specifying it.

Hope that's not too general for you. Me personally, I would not recommend bothering with the built in Report options but using Access as your backend and Excel as your front end for smaller scope projects works really well.
 
Upvote 0
Quick question. Is it an option to use any BI type software? Conditional counting is a very common use item in products like Tableau and PowerBI.
So anytime you need to do calculations in a final result, in nearly all cases, you want to use a view/query to do that and not store it as a table value unless it's truly static and a final value.

Wow. This sounds like exactly what I need. Let me do some studying. Thank you! 🤩👍
 
Upvote 0
You're welcome. You'll still want to store the data somewhere convenient to you but functions like COUNTIF work almost exactly like how they'd work in Excel (in Tableau/PowerBi).
You'll end up using their scripting language to do it though - DAX in PowerBI.

One thing I'd like to mention is normalization of data.
Making one row of data with a whole bunch of columns is basically "first normal form".
For smaller projects, going into the weeds and building it like you would a datawarehouse is overkill.
 
Upvote 0

Forum statistics

Threads
1,223,952
Messages
6,175,595
Members
452,657
Latest member
giadungthienduyen

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top