Workspace
Tjerk Dijkstra/

Joining Data in SQL

0
Beta
Spinner

Joining Data with SQL

Here you can access every table used in the course. To access each table, you will need to specify the world schema in your queries (e.g., world.countries for the countries table, and world.languages for the languages table).


Note: When using sample integrations such as those that contain course data, you have read-only access. You can run queries, but cannot make any changes such as adding, deleting, or modifying the data (e.g., creating tables, views, etc.).

Take Notes

Add notes about the concepts you've learned and SQL cells with queries you want to keep.

Add your notes here

Unknown integration
DataFrameavailable as
world_info
variable
-- Select fields from cities
SELECT DISTINCT(name), country_code,city_proper_pop, metroarea_pop, city_proper_pop / metroarea_pop * 100 AS city_perc
FROM cities,
-- Use subquery to filter city name
 (SELECT capital
 FROM countries
 WHERE continent LIKE 'Europe' OR continent LIKE '%America') AS capital
-- Add filter condition such that metroarea_pop does not have null values
WHERE metroarea_pop IS NOT NULL
-- Sort and limit the result
ORDER BY city_perc DESC
LIMIT 10;
This query is taking long to finish...Consider adding a LIMIT clause or switching to Query mode to preview the result.
  • AI Chat
  • Code