Exercise:)FilteringDatawithSQL)Statements) · Exercise:)FilteringDatawithSQL)Statements)!...
Transcript of Exercise:)FilteringDatawithSQL)Statements) · Exercise:)FilteringDatawithSQL)Statements)!...
Exercise: Filtering Data with SQL Statements The data displayed in table and map view can be filtered so that only a subset of the data is displayed. This is accomplished through the execution of SQL statements that run against the table. To view the SQL editor select the SQL button from the table view interface. You can then write custom SQL commands to filter the data.
In this exercise you will filter data in a table to restrict the records displayed in the table and map views.
Step 1: Login to CartoDB
• Go to http://cartodb.com and login to your account.
Step 2: Import a Dataset In this step you will import a dataset provided by CartoDB.
• From the Dashboard • From the CartoDB dashboard select the Maps dropdown and then
Your datasets.
• Click Data Library
• Click the Search icon and then type “Populated places”. Click the enter key on your keyboard.
• One dataset should be returned. Click the name of the dataset and then ‘Connect dataset’.
• After the dataset has been imported switch to Map View. In the next step we’ll use a SQL statement to filter this dataset so that the returned results are limited.
Step 3: Filter the Data
• Switch back to Data View and find the ‘pop_max’ column. We’re going to define a filter that will display only the populated places where the population is greater than 10 million.
• Click the SQL button seen below.
• Define the query as follows and click the ‘Apply query’ button.
• Switch back to Map View to see the results.
• Double click the cell in the first row of the table under the ‘city’ column.