SQL TUTORIALS

Intro to SELECT Statements Exercise Answer Key

Answer Key

  1. There are 23,119 rows in the earthquake table. Query used:
    SELECT COUNT(*)
    FROM earthquake;
  2. 18,663 Earthquakes occurred before 1/1/2010. Query used:
    SELECT COUNT(*)
    FROM earthquake
    WHERE occurred_on < '1/1/2010';
  3. The First Earthquake took place on 1/1/1969. Query used:
    SELECT occurred_on
    FROM earthquake
    ORDER BY occurred_on
    LIMIT 1;
  4. The Weakest Earthquake took place in Turkmenistan-Iran border region. Query used:
    SELECT place
    FROM earthquake
    ORDER BY magnitude DESC
    LIMIT 1;
  5. The magnitudes for the 10 Weakest Eeathquakes in the 1900s are all 5.5. Query used:
    SELECT magnitude
    FROM earthquake
    WHERE occurred_on < '1/1/2000'
    ORDER BY magnitude
    LIMIT 10;