In-class Exercises
Part 1: Analysis
- Download today's data. It contains a SHP of global dams and reservoirs collected by numerous groups. The data is available here.
- Upload week3data.zip to your Carto account.
- Also unzip week3data.zip on your computer and open the PDF of metadata.
- Create a Carto map with the dams.
- Filter the data using the Filter by column value analysis. For example, show only dams where main_use is Irrigation.
Part 2: Selecting data with SQL
- Open the SQL cheatsheet.
- Open the dams dataset—not as a map.
- Execute a few SQL queries using the patterns outlined in the cheatsheet to answer these questions:
- How many dams are there?
- Which dams are in Japan?
- How many dams are mainly used for irrigation?
- How many dams were built before 1800?
- Which of the above work in the map preview, too?
- Try forming a question of your own and answering it with SQL.
Part 3: Updating data with SQL
- Open the dams dataset.
- Add a new column, name it
quality_display
, and make it a string field. - Put a more readable value in our new column based on the
quality
column. For example:UPDATE dams SET quality_display = 'verified' WHERE quality = '1: Verified'
UPDATE dams SET quality_display = 'good' WHERE quality = '2: Good'
- Continue with the above step for the other
quality
values:3: Fair
,4: Poor
,5: Unreliable
. - Create a map with the dataset and include the new column in the popups.