-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcountriesSelection.mysql
More file actions
20 lines (18 loc) · 1.04 KB
/
countriesSelection.mysql
File metadata and controls
20 lines (18 loc) · 1.04 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
/*
Your friend wants to become a professional tour guide and travel all around the world. In pursuit of this dream, she enrolled in tour guide school.
The professors in this school turned out to be very demanding, and one of them gave your friend a difficult assignment that she has to finish over the weekend.
Here's the assignment: Given a list of countries, your friend should identify all the countries that are in Africa.
To help her, you have decided to write a function that will find all such countries from any set of countries.
The countries table in which the countries are stored has the following structure:
name: the name of the country;
continent: the continent on which the country is situated;
population: the country's population.
Your task is to return a new table that has the same columns, but that only contains the countries from Africa. The countries should be sorted alphabetically by their names.
*/
CREATE PROCEDURE countriesSelection()
BEGIN
SELECT *
FROM countries
WHERE continent = 'Africa'
ORDER BY name;
END