Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Retrieving Multiple Columns | Retrieving Data
Introduction to SQL

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:

Here's a short example of the country table:

id name continent region surfacearea capital population
1 Japan Asia Eastern Asia 377829 Tokyo 126714000
2 Latvia Europe NULL 64589 Riga 2424200
3 Mexico North America Central America 1958201 Mexico City 98881000
4 Netherlands Europe Western Europe 41526 Amsterdam 15864000
... ... ... ... ... ... ...
15 Malta Europe Southern Europe 316 Valletta 380200

Завдання

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

Все було зрозуміло?

Секція 1. Розділ 2
toggle bottom row
course content

Зміст курсу

Introduction to SQL

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:

Here's a short example of the country table:

id name continent region surfacearea capital population
1 Japan Asia Eastern Asia 377829 Tokyo 126714000
2 Latvia Europe NULL 64589 Riga 2424200
3 Mexico North America Central America 1958201 Mexico City 98881000
4 Netherlands Europe Western Europe 41526 Amsterdam 15864000
... ... ... ... ... ... ...
15 Malta Europe Southern Europe 316 Valletta 380200

Завдання

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

Все було зрозуміло?

Секція 1. Розділ 2
toggle bottom row
some-alt