Question: (SQL Questions) (1) Write a query that lists the names of objects which orbit each other.. (Hint: we are looking for rows in the orbits
(SQL Questions)
(1) Write a query that lists the names of objects which orbit each other.. (Hint: we are looking for rows in the orbits table like (a, b) which are repeated in the orbits table in reverse: (b, a).)
(2) Write a query that finds the largest difference in volume between an object and the object it orbits. SQL Question? (using provided code)
Using the code below, answer the questions
INSERT INTO objects(name, class, mass, volume) VALUES ('earth', 'planet', 1.000, 1.0), --units are earth mass, earth volume ('mars', 'planet', 0.107, 0.150), ('venus', 'planet', 0.815, 0.86), ('jupiter', 'planet', 317.8, 1321), ('pluto', 'planet', 0.00218, 0.00651), -- yes, I know its not a planet. ('saturn', 'planet', 95.16, 763.59), --end of planets... ('moon', 'moon', 0.0123, 0.0203), --the rest are moons... ('phobos', 'moon', 1.784e-9, 5.339e-9), ('deimos', 'moon', 0.247e-9, 9.229e-8), ('titan', 'moon', 0.0225, 0.066), ('ganymede', 'moon', 0.025, 0.0704), ('enceladus', 'moon', 1.8e-5, null), ('io', 'moon', 0.015, 0.023), ('rhea', 'moon', 3.9e-4, null), ('charon', 'moon', 2.66e-4, 0.00086); INSERT INTO orbits(orbiting_object, object_that_is_orbited) VALUES ('moon', 'earth'), ('phobos', 'mars'), ('deimos', 'mars'), ('charon', 'pluto'), ('titan', 'saturn'), ('enceladus', 'saturn'), ('rhea', 'saturn'), ('ganymede', 'jupiter'), ('pluto', 'charon'), ('io', 'jupiter');
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
