Your company is planning to expand internationally very soon. You have been tasked with preparing a report on foreign markets and potential competitors. After some investigation, you've created a database containing a foreignCompetitors table, which has the following structure: competitor: the name of the competitor; country: the country in which the competitor is operating. In your report, you need to include the number of competitors per country and an additional row at the bottom that contains a summary: ("Total:", total_number_of_competitors) Given the foreignCompetitors table, compose the resulting table with two columns: country and competitors. The first column should contain the country name, and the second column should contain the number of competitors in this country. The table should be sorted by the country names in ascending order. In addition, it should have an extra row at the bottom with the summary, as described above. |
code>>
/*Please add ; after each select statement*/
CREATE PROCEDURE marketReport()
BEGIN
select IFNULL(country, 'Total:') as country , count(country) as competitors from foreignCompetitors group by country WITH ROLLUP;
END
'알고리즘 > codefightsDB' 카테고리의 다른 글
25>nullIntern (0) | 2019.04.02 |
---|---|
24>websiteHacking (0) | 2019.03.25 |
22>soccerPlayers (0) | 2019.03.25 |
21>travelDiary (0) | 2019.03.25 |
20>movieDirectors (0) | 2019.03.25 |