Course Content
Introduction to SQL
Introduction to SQL
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
.
id
- the record number in this table;name
- the name of the country;continent
- the name of the country's continent;region
- the name of the country's region;SurfaceArea
- the total land area of the country;capital
- the capital of the country;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:
SELECT id, name, capital FROM country;
Here's a short example of the country
table:
Task
You need to retrieve the continent
and population
columns from the country
table.
Task
You need to retrieve the continent
and population
columns from the country
table.
Everything was clear?
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
.
id
- the record number in this table;name
- the name of the country;continent
- the name of the country's continent;region
- the name of the country's region;SurfaceArea
- the total land area of the country;capital
- the capital of the country;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:
SELECT id, name, capital FROM country;
Here's a short example of the country
table:
Task
You need to retrieve the continent
and population
columns from the country
table.
Task
You need to retrieve the continent
and population
columns from the country
table.
Everything was clear?
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
.
id
- the record number in this table;name
- the name of the country;continent
- the name of the country's continent;region
- the name of the country's region;SurfaceArea
- the total land area of the country;capital
- the capital of the country;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:
SELECT id, name, capital FROM country;
Here's a short example of the country
table:
Task
You need to retrieve the continent
and population
columns from the country
table.
Task
You need to retrieve the continent
and population
columns from the country
table.
Everything was clear?
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
.
id
- the record number in this table;name
- the name of the country;continent
- the name of the country's continent;region
- the name of the country's region;SurfaceArea
- the total land area of the country;capital
- the capital of the country;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:
SELECT id, name, capital FROM country;
Here's a short example of the country
table:
Task
You need to retrieve the continent
and population
columns from the country
table.