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
course content

Course Content

Introduction to SQL

Introduction to SQL

1. Retrieving Data
2. Sorting Retrieved Data
3. Filtering Data
4. Advanced Data Filtering
5. Aggregate Functions

bookRetrieving 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:

1
SELECT id, name, capital FROM country;
copy

Here's a short example of the country table:

Task

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

Switch to desktopSwitch to desktop for real-world practiceContinue from where you are using one of the options below
Everything was clear?

How can we improve it?

Thanks for your feedback!

Section 1. Chapter 2
toggle bottom row

bookRetrieving 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:

1
SELECT id, name, capital FROM country;
copy

Here's a short example of the country table:

Task

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

Switch to desktopSwitch to desktop for real-world practiceContinue from where you are using one of the options below
Everything was clear?

How can we improve it?

Thanks for your feedback!

Section 1. Chapter 2
toggle bottom row

bookRetrieving 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:

1
SELECT id, name, capital FROM country;
copy

Here's a short example of the country table:

Task

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

Switch to desktopSwitch to desktop for real-world practiceContinue from where you are using one of the options below
Everything was clear?

How can we improve it?

Thanks for your feedback!

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:

1
SELECT id, name, capital FROM country;
copy

Here's a short example of the country table:

Task

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

Switch to desktopSwitch to desktop for real-world practiceContinue from where you are using one of the options below
Section 1. Chapter 2
Switch to desktopSwitch to desktop for real-world practiceContinue from where you are using one of the options below
some-alt