Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR SQL

Three inner joins SQL

-- Using INNER JOING to join multiple tables
SELECT c.code, name, region, e.year, fertility_rate, unemployment_rate -- Select fields
  FROM countries AS c -- From countries (alias as c)
  INNER JOIN populations AS p -- Join to populations (as p)
    ON c.code = p.country_code -- Match on country code
  INNER JOIN economies AS e -- Join to economies (as e)
    ON c.code = e.code AND p.year = e.year; -- Match on country code and year
Source by campus.datacamp.com #
 
PREVIOUS NEXT
Tagged: #Three #joins #SQL
ADD COMMENT
Topic
Name
9+2 =