Course Content
Introduction to SQL
Introduction to SQL
Retrieving Multiple Columns
Inspecting the Table
Let's delve deeper into the country
database. This database contains a single table, also named country
. We'll take a closer look at the data within this table.
This table contains 15 rows, representing 15 unique records for various countries.
Now, let's discuss the columns. The table includes 7 columns: id
, name
, continent
, region
, SurfaceArea
, capital
, and population
.
-
id
- the unique identifier for each record; -
name
- the name of the country; -
continent
- the continent where the country is located; -
region
- the specific region within the continent; -
SurfaceArea
- the total land area of the country; -
capital
- the capital city of the country; -
population
- the number of people living in the country.
The Syntax for Selecting Multiple Columns
To retrieve multiple columns, use the SELECT
statement. After SELECT
, list the column names you want to retrieve, separated by commas.
The syntax looks like this:
Here's an example of how to select three columns from the country
table:
SELECT id, name, capital FROM country;
Here's a short example of the country
table:
Swipe to show code editor
Write an SQL query to retrieve the continent
and population
columns from the country
table.
Note
Remember that columns must be separated by commas!
Thanks for your feedback!
Retrieving Multiple Columns
Inspecting the Table
Let's delve deeper into the country
database. This database contains a single table, also named country
. We'll take a closer look at the data within this table.
This table contains 15 rows, representing 15 unique records for various countries.
Now, let's discuss the columns. The table includes 7 columns: id
, name
, continent
, region
, SurfaceArea
, capital
, and population
.
-
id
- the unique identifier for each record; -
name
- the name of the country; -
continent
- the continent where the country is located; -
region
- the specific region within the continent; -
SurfaceArea
- the total land area of the country; -
capital
- the capital city of the country; -
population
- the number of people living in the country.
The Syntax for Selecting Multiple Columns
To retrieve multiple columns, use the SELECT
statement. After SELECT
, list the column names you want to retrieve, separated by commas.
The syntax looks like this:
Here's an example of how to select three columns from the country
table:
SELECT id, name, capital FROM country;
Here's a short example of the country
table:
Swipe to show code editor
Write an SQL query to retrieve the continent
and population
columns from the country
table.
Note
Remember that columns must be separated by commas!
Thanks for your feedback!
Retrieving Multiple Columns
Inspecting the Table
Let's delve deeper into the country
database. This database contains a single table, also named country
. We'll take a closer look at the data within this table.
This table contains 15 rows, representing 15 unique records for various countries.
Now, let's discuss the columns. The table includes 7 columns: id
, name
, continent
, region
, SurfaceArea
, capital
, and population
.
-
id
- the unique identifier for each record; -
name
- the name of the country; -
continent
- the continent where the country is located; -
region
- the specific region within the continent; -
SurfaceArea
- the total land area of the country; -
capital
- the capital city of the country; -
population
- the number of people living in the country.
The Syntax for Selecting Multiple Columns
To retrieve multiple columns, use the SELECT
statement. After SELECT
, list the column names you want to retrieve, separated by commas.
The syntax looks like this:
Here's an example of how to select three columns from the country
table:
SELECT id, name, capital FROM country;
Here's a short example of the country
table:
Swipe to show code editor
Write an SQL query to retrieve the continent
and population
columns from the country
table.
Note
Remember that columns must be separated by commas!
Thanks for your feedback!
Inspecting the Table
Let's delve deeper into the country
database. This database contains a single table, also named country
. We'll take a closer look at the data within this table.
This table contains 15 rows, representing 15 unique records for various countries.
Now, let's discuss the columns. The table includes 7 columns: id
, name
, continent
, region
, SurfaceArea
, capital
, and population
.
-
id
- the unique identifier for each record; -
name
- the name of the country; -
continent
- the continent where the country is located; -
region
- the specific region within the continent; -
SurfaceArea
- the total land area of the country; -
capital
- the capital city of the country; -
population
- the number of people living in the country.
The Syntax for Selecting Multiple Columns
To retrieve multiple columns, use the SELECT
statement. After SELECT
, list the column names you want to retrieve, separated by commas.
The syntax looks like this:
Here's an example of how to select three columns from the country
table:
SELECT id, name, capital FROM country;
Here's a short example of the country
table:
Swipe to show code editor
Write an SQL query to retrieve the continent
and population
columns from the country
table.
Note
Remember that columns must be separated by commas!