Course Content
Introduction to SQL
Introduction to SQL
1. Retrieving Data
Retrieving Individual ColumnsRetrieving Multiple Columns Retrieving All ColumnsRetrieving Distinct RowsLimiting ResultsChallenge: Find the Population of the CountriesChallenge: Find All CountriesChallenge: Find All Countries With Their IDsChallenge: Find Country CapitalsChallenge: Find the Regions in Which All Countries Are Located
2. Sorting Retrieved Data
Sorting DataChallenge: Population SortSorting by Multiple ColumnsChallenge: Dual-Sort QuerySpecifying Sort DirectionChallenge: Sort the Countries by Region and CapitalChallenge: Sort Capitals in Descending OrderChallenge: Sort Countries in Ascending OrderChallenge: Find Countries, Their IDs, and Their PopulationsChallenge: Find Countries, IDs, Populations, Regions, and Sort ThemChallenge: Find All Continents and Sort Them in Ascending Order
The SUM() Function
SUM()
returns the total of all the values in a given column.
Here’s an example:
SELECT SUM(population) FROM country WHERE continent='Asia';
The SUM()
function calculates the total population of all Asian countries found in the country
table.
Here is the country
table we are working with:
Task
Swipe to start coding
Write an SQL query that returns the sum of the surfacearea
of countries from 'Europe'.
Solution
Everything was clear?
Thanks for your feedback!
Section 5. Chapter 8
The SUM() Function
SUM()
returns the total of all the values in a given column.
Here’s an example:
SELECT SUM(population) FROM country WHERE continent='Asia';
The SUM()
function calculates the total population of all Asian countries found in the country
table.
Here is the country
table we are working with:
Task
Swipe to start coding
Write an SQL query that returns the sum of the surfacearea
of countries from 'Europe'.
Solution
Everything was clear?
Thanks for your feedback!
Section 5. Chapter 8