Ctr

Car Shopping

You're buying a used car on a community-based commerce website called "Greg's List". The cars for sale are in the cars table.


cars
column_name type
id
INTEGER
make
VARCHAR
model
VARCHAR
year
INTEGER
color
VARCHAR
asking_price_usd
INTEGER
miles_driven
NUMERIC
is_paid_off
BOOL

The asking_price_usd column is the price of the car in US dollars. The is_paid_off column is the first boolean column we've seen. It is TRUE if the owner doesn't have loans (a lien) on the car.

You need to find a car for yourself that meets all of these requirements:

  1. The color is black, gray, silver, or white, because you don't like vibrant colors.
  2. The make is not Hyundai, because you don't like Hyundai.
  3. Has a price between $5000 and $7000 to fit in your budget.
  4. Hasn't been driven more than 125,000 miles.
  5. Is newer than year 2005, otherwise it's too old.
  6. Doesn't have a lien, meaning it has already been paid off.

Use a WHERE clause and your knowledge of conditions and operators to find the cars that satisfy your needs.

© 2022 Andrew Carlson. All rights reserved.

make
VARCHAR
model
VARCHAR
year
INTEGER
color
VARCHAR
asking_price_usd
INTEGER
miles_driven
NUMERIC
is_paid_off
BOOL
1
nissan
sentra
2016
black
6000
110000.0
TRUE
2
honda
civic
2006
white
6250
6000.0
TRUE
2 rows

You haven't solved this challenge yet!
Are you sure you want to reveal the answer?