186k views
2 votes
Perform an inner join of countries as c (left) with populations as p (right), on code. Select name, year, and fertility rate.

a) SELECT c.name, p.year, p.fertility_rate FROM countries c INNER JOIN populations p ON c.code = p.code
b) SELECT name, year, fertility_rate FROM countries LEFT JOIN populations ON c.code = p.code
c) SELECT name, year, fertility_rate FROM countries INNER JOIN populations ON c.code = p.code
d) SELECT c.name, p.year, c.fertility_rate FROM populations p LEFT JOIN countries c ON p.code = c.code

1 Answer

4 votes

Final answer:

The correct answer is: a) SELECT c.name, p.year, p.fertility_rate FROM countries c INNER JOIN populations p ON c.code = p.code. This query performs an inner join of the 'countries' table with the 'populations' table using the 'code' column, and selects the 'name', 'year', and 'fertility_rate' columns.

Step-by-step explanation:

The correct answer is:

a) SELECT c.name, p.year, p.fertility_rate FROM countries c INNER JOIN populations p ON c.code = p.code

In this query, we are performing an inner join of the 'countries' table as 'c' (on the left) with the 'populations' table as 'p' (on the right) using the 'code' column. The selected columns are 'name', 'year', and 'fertility_rate' from both tables. This will give us the names of countries, years, and their corresponding fertility rates.

User Benjumanji
by
8.5k points