In-class Exercises
Part 1: Analysis
- Download today's data. It's from Map Kibera.
- Add both shapefiles to your CARTO account.
- Create a map with both shapefiles.
- Add a buffer to the education layer using the Create areas of influence analysis. For this exercise, let's create buffers of 150 meters.
- Count the number of watsan features in each buffer by adding another analysis to the education layer: Intersect second layer. Choose the watsan layer as the intersect layer.
- The number of watsan features should be in a new column,
count_vals
. Style the school buffers using this column.
Part 2: Selecting data with SQL
- Open the SQL cheatsheet.
- Open the education dataset—not as a map.
- Execute a few SQL queries using the patterns outlined in the cheatsheet:
- Count the schools
- Select schools that are
religious
- Select schools with an email address
- Select schools with a count of students
- Average the count of students (you will have to convert it to a number field first)
- Find the minimum number of students
- Which of the above work in the map preview, too?
Part 3: Updating data with SQL
- Open the education dataset.
- Ensure the
students
andteachers
columns are numbers field. - Add a new column, name it
st_ratio
, and make it a number field. - Calculate the student-teacher ratio and put it in the new column:
UPDATE education SET st_ratio = students / teachers
- Create a map styling the education features by
st_ratio
.