Common Keywords Exercise Answer Key
Answer Key
- 12 earthquakes occurred in Northern California with a magnitude between 6.0 and 7.0. Query used:
SELECT DISTINCT *
FROM earthquake
WHERE place LIKE '%Northern California%' AND magnitude BETWEEN 6.0 AND 7.0;
- The deepest earthquake that occurred in either Utah, Oregon, Wyoming, or Egypt was 21.5 meters deep. Query used:
SELECT MAX(depth) AS max_depth
FROM earthquake
WHERE place IN('Utah', 'Oregon', 'Wyoming', 'Egypt');
- There are 0 NULL values in the "place" column. Query used:
SELECT COUNT(*)
FROM earthquake
WHERE place IS NULL;
- There are 978 places that either start with an "A" or end with an "r". Query used:
SELECT DISTINCT COUNT(*)
FROM earthquake
WHERE place LIKE 'A%' OR place LIKE '%r';
- The average depth for all earthquakes that occurred between 1/1/1970 and 1/1/1990, had a magnitude of at least 6.0 and were caused by an earthquake is 69.83 meters. Query used:
SELECT AVG(depth) AS avg_depth
FROM earthquake
WHERE occurred_on BETWEEN '1/1/1970' AND '1/1/1990' AND magnitude >= 6.0 AND cause = 'earthquake';