Menu
Coddy logo textTech

Recap - With Queries

Part of the Fundamentals section of Coddy's SQL journey — lesson 50 of 72.

challenge icon

Challenge

Easy

Available tables and columns:

  • <b>devices_specs</b>: <b>device_id</b>, <b>width</b>, <b>height</b>, <b>num_features</b>, <b>opinion</b>
  • <b>devices_score</b>: <b>device_id</b>, <b>score</b>

A device's quality is measured by (width/height)*num_features.

We want to find all of the overrated devices. Fetch all of the devices where the device's opinion is greater than the average quality and the device's score is less than the average quality. Return only the device_id.

To solve it, use the WITH clause to create a subquery that calculates the average quality and reuse it in the main query.

Try it yourself

All lessons in Fundamentals