Professional Documents
Culture Documents
Ultimo Desafio Kha Academi
Ultimo Desafio Kha Academi
Ultimo Desafio Kha Academi
/*Return all objects where surface gravity is greater than the surface gravity
of the earth*/
SELECT body, surface_gravity FROM solar_system_objects WHERE surface_gravity > (
SELECT surface_gravity FROM solar_system_objects WHERE body = "Earth");
/*Return count of each object with mean radius larger than earth and smaller
than earth*/
SELECT COUNT(*),
CASE
WHEN mean_radius_rel > 1 THEN "Big Than Earth"
WHEN mean_radius_rel = 1 THEN "Earth"
WHEN mean_radius_rel < 1 THEN "Smaller Than Earth"
END AS "relative_size_to_earth"
FROM solar_system_objects
GROUP BY relative_size_to_earth