Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

You will use the following four tables for a product review database in the quiz. The following SQL statement tries to select number of reviews

image text in transcribedimage text in transcribed

You will use the following four tables for a product review database in the quiz. The following SQL statement tries to select number of reviews for all SUV (SUV is the name of a category). Please decide whether there is a bug and if so how to fix it. (30 points) select count(*) from review r, category C where c.cid = r.pid and cname = 'SUV'; Tables First row shows column name and type, explanation of the column, primary and foreign key (in bold) The remaining rows are some sample data Category table: stores product category. A category may have sub (parent) category. E.g., SUV and Sedan categories have the same parent category cars CID int CNAME varchar(50) Parent_CID int --- Category ID, primary key --- Category name --- parent category ID, foreign key references Category 2 cars NULL 4 SUV 2 --- parent category is 2 (cars) Product table: stores product information PID int CID int PNAME varchar(50) --- product ID, primary key -- category ID, foreign key -- product name references category Honda CR-V Ford Escape Users Table: stores user information (who can write reviews) 3 4 4 4 UUID int User id, primary key 1 2 Review Table: stores review of a user for a product Uname varchar(50) User name Eric Priya PNAME varchar(50) product name ---- PID int CID int product ID, primary key --- category ID, foreign key references category 3 4 4 4 Users Table: stores user information (who can write reviews) Honda CR-V Ford Escape Uname varchar(50) User name -- UUID int -User id, primary key 1 2 Review Table: stores review of a user for a product Eric Priya Uuid int ---user ID Foreign key references users Rdate date Rating review date number ---review rating Rcomment varchar(100) --- comment Rid int Pid int -- review ID, - product ID primary key Foreign Key references Product 1 3 3 4 4 4 For the toolbar nirne NITALIA 1 5 2021-02-01 2021-02-15 2021-02-09 2. 1 4 Most popular Good performance Improved reliability 4

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Big Data, Mining, And Analytics Components Of Strategic Decision Making

Authors: Stephan Kudyba

1st Edition

1466568704, 9781466568709

More Books

Students also viewed these Databases questions