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]
3 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]3 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
When you take a multiple-choice test, you are relying on ________, a means of retrieving information out of your long-term memor
miv72 [106K]

Answer:

recognition

Explanation:

<h2><u>Fill in the blanks</u></h2>

When you take a multiple-choice test, you are relying on <u>recognition</u> , a means of retrieving information out of your long-term memory storage system that helps you choose the correct answer.

4 0
3 years ago
. In the BorderLayout class, what are NORTH, SOUTH, EAST, WEST, and CENTER?
ycow [4]

Answer:

A BorderLayout corresponds to a layout type where the components are organized along geographical directions represented by NORTH, SOUTH, EAST, WEST, and CENTER.

Explanation:

The layout class is awt determines the actual placement of components in the user interface. BorderLayout is a layout where the components are organized along geographical directions represented by NORTH, SOUTH, EAST, WEST, and CENTER. For example:

Panel p = new Panel();

p.setLayout(new BorderLayout());

p.add(new TextArea(), BorderLayout.CENTER);

p.add(new Button("Close"), BorderLayout.SOUTH);

This code segment will add a textarea at the CENTER of the interface and a button 'Close' towards the SOUTH.

8 0
3 years ago
What is the purpose of a mail merge field?
goblinko [34]

Answer:

Mail Merge is a way to send the same message to a large number of persons, with each one properly addressed to a specific person.

Explanation:

8 0
3 years ago
Read 2 more answers
Your computer uses 4 bits to represent decimal numbers (0, 1, 2, 3 and so on) in binary. What is the SMALLEST number for which a
natali 33 [55]
2 I think because 2 I think is binary I’m sorry if this is wrong
8 0
3 years ago
You are a psychologist who needs to provide a qualitative evaluation for IQ scores. Create a program that takes IQ scores (one a
dsp73

Answer:

Check the explanation

Explanation:

#include <iostream>

#include <iomanip>

using namespace std;

int getIQ(); // return the score

void printEvaluation(int);

int main()

{

   int IQ = 0;

   IQ = getIQ();

   

   printEvaluation(IQ);

   return 0;

}

int getIQ()

{

   int score = 0;

   cout << "Please enter your IQ Score to receive your IQ Rating:\n";

   cin >> score;

   

   return score;

}

void printEvaluation(int aScore)

{

   cout << "IQ Score: " << aScore << " IQ Rating: ";

   

   if (aScore <= 100)

   {

       cout << "Below Average\n";

   }

   else if (aScore <= 119)

   {

       cout <<"Average\n";

   }

   else if (aScore <= 160)

   {

       cout << "Superior\n";

   }

   else if (aScore >= 160 )

   {

       cout << "Genius\n";

   }

}

4 0
3 years ago
Other questions:
  • HURRYYY A friend of yours has E-mailed their English paper to you so that you can proofread it. Explain the tools you would use
    15·1 answer
  • Which of these browsers was the first widely adopted?
    12·1 answer
  • Interactive sites where users write personal topics and comments to a threadded discussion are called?
    11·1 answer
  • 5. Why are female fans particularly valuable to the sports industry? Cite two<br> specific reasons.
    11·1 answer
  • In today's classrooms, computers are generally being used to
    6·1 answer
  • Which is the hanging indent on the ruler?
    10·2 answers
  • bro this scared me, i thought i just got hacked, could someone explain why when i went to ask a question, it kicked me out my ac
    9·2 answers
  • Define online pollution
    5·1 answer
  • In a mobile phone network, how many times as strong would
    6·1 answer
  • Visual Basic: What are arrays, please give an example code.
    8·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!