Skip to content
  1. Query full table
Spinner
DataFrameas
df
variable
SELECT *
FROM climate
  1. Query the country and water_stress_index fields and order by descending order of the water_stress_index field
Spinner
DataFrameas
df
variable
SELECT country, water_stress_index
FROM climate
ORDER BY 2 DESC;
  1. Query country, year, and gdp_per_capita fields to get a list of distinct counry names and their respective GDP. order by the GDP in ascending order but only view the top 10 values
Spinner
DataFrameas
df
variable
SELECT DISTINCT country, year, gdp_per_capita
FROM climate
ORDER BY gdp_per_capita
LIMIT 10
  1. Filter the data to see the country and year where the water_stress_index was between 0.5 and 0.6``
Spinner
DataFrameas
df
variable
SELECT country, year, water_stress_index
FROM climate
WHERE water_stress_index BETWEEN 0.5 AND 0.6
  1. Filter the data to see the countries that start with the letter E or S and have water_stress_index above 0.5
Spinner
DataFrameas
df
variable
SELECT country, year, water_stress_index 
FROM climate
WHERE water_stress_index > 0.5 AND (country LIKE 'E%' OR country LIKE 'S%');
  1. See what the average water_related_adaptation_tech value is for each country across all of the years and order by descending order of this average
Spinner
DataFrameas
df
variable
SELECT country, AVG(water_related_adaptation_tech) AS avg_water_tech
FROM climate
GROUP BY country
ORDER BY avg_water_tech DESC 
  1. Find the countries that have an average water_related_adapptation_tech value greater than 1 and list only the countries
Spinner
DataFrameas
df
variable
SELECT country
FROM climate 
GROUP BY country
HAVING AVG(water_related_adaptation_tech) > 1

No Code Plot!