Retrieving Multiple Columns Retrieving Multiple Columns

Let's explore this database a bit further. The country database consists of a single table named country. Let's examine the contents of this table.

This table has 15 rows, which means we have 15 distinct records for different countries.

Now, what about the columns? In this table, we have 7 columns, like id, name, continent, region, SurfaceArea, capital, and population.

  1. id - the record number in this table;
  2. name - the name of the country;
  3. continent - the name of the country's continent;
  4. region- the name of the country's region;
  5. SurfaceArea - the total land area of the country;
  6. capital - the capital of the country;
  7. population - the population of the country.

We can also retrieve multiple columns with the SELECT operator. The only difference is that after the word SELECT, we will need to specify several column names, which must be separated by commas. Let’s take an example where we retrieve three columns from the country table:

Task

You need to retrieve the continent and population columns from the country table.

Here's a short example of the country table:

idnamecontinentregionsurfaceareacapitalpopulation
1JapanAsiaEastern Asia377829Tokyo126714000
2LatviaEuropeNULL64589Riga2424200
3MexicoNorth AmericaCentral America1958201Mexico City98881000
.....................
15MaltaEuropeSouthern Europe316Valletta380200

Everything was clear?

Section 1. Chapter 2
toggle bottom row