Get a list of the number of products reviewed for every retailer

Oracle 12c: SQL
3rd Edition
ISBN:9781305251038
Author:Joan Casteel
Publisher:Joan Casteel
Chapter12: Subqueries And Merge Statements
Section: Chapter Questions
Problem 14MC
icon
Related questions
Question

I need help with the SQL query for the following question:

1. Get a list of the number of products reviewed for every retailer

Here is the information on the field names:

The table name is:  Reviews

Review Form Fields

Product/ModelName:

Product/Category:

Product/Price:

Retailer/Name:

Retailer/ZipCode:

Retailer/City:

Retailer/State:

Product/On Sale:

Manufacturer/Name:

Manufacturer/Rebate:

Review/UserId:

Review/Rating:

Review/Date:

Review/Text:

Example of Review Form Filled out

ProductModelName: Galaxy S4

ProductCategory: Smart Phone

ProductPrice: 499

RetailerName: Bestbuy

RetailerZipCode: 44114

RetailerCity: Cleveland

RetailerState: OH

ProductOnSale: No

ManufacturerName: Samsung

ManufacturerRebate: No

ReviewUserId: xmm473

ReviewRating: 3

ReviewDate: 6/10/2012

ReviewText: overheats after 2 hours

Expert Solution
Step 1

TABLES

The tables based on the given forms are shown below.

Product ( PID, ModelName, Category, Price )

Retailer (  RID, Name, City, State, ZipCode )

SoldBy ( SID, RetailerID, ProductID )

Review ( ReviewID, UserID, ProductID, ReviewDate, Rating, Review )

Manufacturer ( MID, Name )

User ( UID )

Step 2

The COUNT() is an aggregate function which returns the number of rows either in the whole table or entity wise.

 

Here, the number of products which got reviewed by customer, for each retailer, is required.

Hence, COUNT() will be used on the product column from the Review table.

 

Next, number of products reviewed is required retailer-wise.

The GROUP BY clause is used on the retailer column from the Review table.

steps

Step by step

Solved in 3 steps

Blurred answer
Knowledge Booster
SQL Query
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Recommended textbooks for you
Oracle 12c: SQL
Oracle 12c: SQL
Computer Science
ISBN:
9781305251038
Author:
Joan Casteel
Publisher:
Cengage Learning
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781305627482
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781285196145
Author:
Steven, Steven Morris, Carlos Coronel, Carlos, Coronel, Carlos; Morris, Carlos Coronel and Steven Morris, Carlos Coronel; Steven Morris, Steven Morris; Carlos Coronel
Publisher:
Cengage Learning
A Guide to SQL
A Guide to SQL
Computer Science
ISBN:
9781111527273
Author:
Philip J. Pratt
Publisher:
Course Technology Ptr
Np Ms Office 365/Excel 2016 I Ntermed
Np Ms Office 365/Excel 2016 I Ntermed
Computer Science
ISBN:
9781337508841
Author:
Carey
Publisher:
Cengage
CMPTR
CMPTR
Computer Science
ISBN:
9781337681872
Author:
PINARD
Publisher:
Cengage