Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Considering the following 4 tables: Please answer these questions with SQL queries: For each item which has at least two ratings, find the average rating

Considering the following 4 tables:

image text in transcribed

image text in transcribed

image text in transcribed

Please answer these questions with SQL queries:

  1. For each item which has at least two ratings, find the average rating for the item.
  2. For each user, find the descriptions of items they have bought but not rated.
  3. Find the names of users who have bought items with a total value of more than 1000.
  4. For each category, find the average current price of items in that category.

Table user id, name) Result Grid | 2 id name W N H Smith John Tina 4 Sam NULL NULL Table item (id, description, category, price) price 8.99 5.50 Result Grid 3 e Filter Rows: id description category 5 The Hobbit book 6 White Fang book 7 Chair furniture 8 Sofa furniture 9 Shirt clothing 10 Shoes clothing Fridge appliances 12 Dishwasher appliances 39.99 545.00 50.99 150.50 645.00 399.99 NULL NULL NULL NULL Table buys (user, item, price) primary key(user, item), foreign key(user) references user(id). foreign key(item) references item(id) Result Grid 1 Filter Rows: user item price 0 00 un W WN N N ++ OSSOL00 8 8.99 545.00 50.99 645.00 545.00 150.50 399.99 5.50 39.99 NULL 4 4 7 HULL NULL Table rates (user, item, rating) primary key(user, item), foreign key(user) references user(id), foreign key(item) references item(id) Result Grid 1 e Filter Rc user item rating 5 5 8 w 5 5 HN N N M M M tt at E Evo 8 4 NULL 13 10 12 5 6 3 7 NULL 2 NULL NULL

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

Fundamentals Of Database System

Authors: Elmasri Ramez And Navathe Shamkant

7th Edition

978-9332582705

More Books

Students also viewed these Databases questions