Deals Of The Week - hours only!Up to 80% off on all courses and bundles.-Close
Introduction
Numbers
Boolean
Date and time
Summary

Instruction

Excellent! You can also use math and logical operators with DOUBLE and REAL columns. If we only wanted to show people who weigh 80 kg or less, we could write the following:

SELECT *
FROM body
WHERE weight <= 80;

Simple, isn't it?

Exercise

Peter got feedback from his users. They complain that weight tells us nothing without height! After all, it's nothing extraordinary for a man 2 meters tall to weigh 85 kg. But the same weight is no good for someone whose height is 1.60 m.

In our table body, we now have three columns: user_id, weight and height. Select all the information about users for whom the ratio weight/height is lower than 0.5.

Stuck? Here's a hint!

Type

SELECT *
FROM body
WHERE (weight/height) < 0.5;