1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Svetradugi [14.3K]
4 years ago
8

You’ve been hired to work on a web site that maintains customer reviews of products. The main data is stored in the following ta

bles: Product(Product ID, Product Name, Description) Reviewer(Reviewer ID, Reviewer Name, City) Review(Reviewer ID, Product ID, Rating, Comment) The tables contain the following information:
Product: unique product id (Product ID), product name (Product Name), and product description. All strings. • Reviewer: unique reviewer id (Reviewer ID), and reviewer name (Reviewer Name) and city, also all strings. • Review: One entry for each individual review giving the reviewer and product ids, an integer rating in the range 0‐5, and the reviewer comment, which is a string.
A) Write a SQL query that returns the number of reviewers in each distinct city. The results should list the city name and the number of reviewers in that city, and should be sorted alphabetically by city name.
B) Write a SQL query that returns the average of the reviews for each reviewer and names of the reviewers for all reviewers that have an average review (of all their reviews) of less than or equal to 2.
Computers and Technology
1 answer:
olya-2409 [2.1K]4 years ago
6 0

Answer:

See explaination

Explanation:

a.

//to create product table

CREATE TABLE PRODUCT

(

PRODUCTID VARCHAR2(50) NOT NULL

, PRODUCTNAME VARCHAR2(50) NOT NULL

, DESCRIPTION VARCHAR2(50) NOT NULL

, CONSTRAINT PRODUCT_PK PRIMARY KEY

(

PRODUCTID

)

);

//to create Reviewer table

CREATE TABLE REVIEWER

(

REVIEWERID VARCHAR2(50) NOT NULL ,

REVIEWERNAME VARCHAR2(50) NOT NULL ,

CITY VARCHAR2(50) NOT NULL ,

CONSTRAINT REVIEWER_PK PRIMARY KEY ( REVIEWERID )

);

// to create Review table

CREATE TABLE REVIEW

(

REVIEWERID VARCHAR2(50) NOT NULL ,

PRODUCTID VARCHAR2(50) NOT NULL ,

RATING NUMBER(5, 0) NOT NULL ,

COMMENTS VARCHAR2(50) NOT NULL ,

CONSTRAINT REVIEW_PK PRIMARY KEY ( REVIEWERID , PRODUCTID )

);

b.

SELECT CITY,COUNT( REVIEWERID) NOOFREVIEWERS FROM REVIEWER GROUP BY CITY ORDER BY CITY ;

EXPLANATION

GROUP BY clause classifies the data in the table it avoids duplicates in the table

ORDER BY clause by default sort the table in ascending order

in the select clause city is the single column count is group function so we must need to write group by clause

otherwise we will get

SQL Error: ORA-00937: not a single-group group function

You might be interested in
Which is the best book for C,C++,C# and objective C??
Korvikt [17]

Answer:

Head First books

Explanation:

My professor recommended them for basically any language. I ordered one for C off amazon and I love it. It's funny, interesting and educational all at once. Would recommend 10/10.

3 0
3 years ago
Access is generally used to work with ________ databases.
d1i1m1o1n [39]

Answer:

access is generally used to work with relational databases

8 0
3 years ago
Which automated method for VPN connection deployment would work best in combination with Microsoft Intune or Microsoft Endpoint
maks197457 [2]

There are different kinds of automated method for VPN connection deployment. The automated method for VPN connection deployment would work best  is ProfileXML

  • ProfileXML is known to be often used as a delivery methods in Windows PowerShell, Microsoft Endpoint Configuration Manager, and Intune. For an individual to be able to use the ProfileXML VPNv2 CSP setting, one have to construct XML by using the ProfileXML schema.

An individual can configure the Always On VPN client by using the PowerShell, Microsoft Endpoint Configuration Manager, or Intune. They all need an XML VPN profile to configure the appropriate VPN settings.

Learn more from

brainly.com/question/25554117

3 0
3 years ago
Which of the following graphs corresponds to the given function?
Julli [10]
What graphs? There are no graphs shown...
6 0
3 years ago
Read 2 more answers
Write an alogrithm to display the first ten even numbers​
sladkih [1.3K]

Answer:

Step1:start

step2: enter the ten number

s3: if the number is divided by 2 then print even number

s4: otherwise print odd number

s5:stop

4 0
3 years ago
Other questions:
  • Write a java program called allDigitsOdd that returns whether every digit of a positive integer is odd. Return true if the numbe
    6·1 answer
  • What was the benefit of a caloytpe over a daguerreotype
    6·2 answers
  • If I execute the expression x <- 4L in R, what is the class of the object `x' as determined by the `class()' function?
    5·1 answer
  • A(n) __________ is a device or software that is designed to block unauthorized access while allowing authorized communications.
    13·1 answer
  • Alisha appears to be overconfident which makes her unapproachable to her employees. Which negative quality is she displaying?
    8·2 answers
  • When a module is executing what happens when the end of the module is reached?
    10·1 answer
  • Betty removed a web page from her website. Some users were browsing on her website. One of them clicked on a particular link and
    15·1 answer
  • While using a web-based order form, an attacker enters an unusually large value in the Quantity field. The value he or she enter
    15·1 answer
  • Visit on social networking site and look for the site's privacy policy.The link is typically found at the bottom of the page and
    9·1 answer
  • What can be used to help diagnose and fix computer hardware problems?
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!