Skip to content

Commit ec92b18

Browse files
refactor 618
1 parent 81f82d9 commit ec92b18

File tree

1 file changed

+0
-18
lines changed

1 file changed

+0
-18
lines changed

Diff for: database/_618.sql

-18
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,3 @@
1-
--618. Students Report By Geography
2-
--
3-
--A U.S graduate school has students from Asia, Europe and America. The students' location information are stored in table student as below.
4-
--
5-
--| name | continent |
6-
--|--------|-----------|
7-
--| Jack | America |
8-
--| Pascal | Europe |
9-
--| Xi | Asia |
10-
--| Jane | America |
11-
--Pivot the continent column in this table so that each name is sorted alphabetically and displayed underneath its corresponding continent. The output headers should be America, Asia and Europe respectively. It is guaranteed that the student number from America is no less than either Asia or Europe.
12-
--For the sample input, the output is:
13-
--| America | Asia | Europe |
14-
--|---------|------|--------|
15-
--| Jack | Xi | Pascal |
16-
--| Jane | | |
17-
--Follow-up: If it is unknown which continent has the most students, can you write a query to generate the student report?
18-
191
--reference: https://discuss.leetcode.com/topic/92752/accept-solution and https://leetcode.com/articles/students-report-by-geography/#approach-using-session-variables-and-join-accepted
202

213
set @a = 0;

0 commit comments

Comments
 (0)