Skip to content
Joining Data in SQL
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).
Take Notes
Add notes about the concepts you've learned and SQL cells with queries you want to keep.
Add your notes here
DataFrameas
world_info
variable
-- Add your own queries here
SELECT *
FROM world.languages
LIMIT 5
SQL madhe name IS NULL asta and not name = NULL. Python sarkha karat baslo ani couldn't even figure out what was going wrong. Thus, keep in mind that IS NULL is something that works in SQL and not x = NULL
In the following code I was trying to find countries that had prime minister and president.
DataFrameas
df
variable
select * from world.presidents
DataFrameas
df
variable
select * from world.prime_ministers
DataFrameas
df
variable
select pm.country, pm.prime_minister as prime_minster, p.president as president
from world.prime_ministers as pm
inner join world.presidents as p
on pm.country = p.country
DataFrameas
df
variable
select pm.country, pm.prime_minister as prime_minster, p.president as president
from world.prime_ministers as pm
left join world.presidents as p
on pm.country = p.country
DataFrameas
df
variable
select pm.country, pm.prime_minister as prime_minster, p.president as president
from world.prime_ministers as pm
right join world.presidents as p
on pm.country = p.country
Trying to use the INTERSECT operator
DataFrameas
df
variable
select country intersect_country, prime_minister pm from world.prime_ministers
INTERSECT
select country, president from world.presidents