From 46ff015ee3c0ff896c84041301b71b64b5e291d8 Mon Sep 17 00:00:00 2001
From: openset
### Related Topics
diff --git a/problems/students-report-by-geography/README.md b/problems/students-report-by-geography/README.md
index eef8dbeb3..365f6519f 100644
--- a/problems/students-report-by-geography/README.md
+++ b/problems/students-report-by-geography/README.md
@@ -11,8 +11,9 @@
## 618. Students Report By Geography (Hard)
-A U.S graduate school has students from Asia, Europe and America. The students' location information are stored in table student
as below.
student
as below.
++
| name | continent | |--------|-----------| @@ -20,16 +21,24 @@ A U.S graduate school has students from Asia, Europe and America. The students' | Pascal | Europe | | Xi | Asia | | Jane | America | -- - 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. - -For the sample input, the output is: + + +
+ 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. + +
+For the sample input, the output is: + +
+
| America | Asia | Europe | |---------|------|--------| | Jack | Xi | Pascal | | Jane | | | -- -Follow-up: If it is unknown which continent has the most students, can you write a query to generate the student report? + + +
+Follow-up: If it is unknown which continent has the most students, can you write a query to generate the student report? + +
diff --git a/problems/swap-salary/README.md b/problems/swap-salary/README.md index f94ea2e00..e4bc1dc15 100644 --- a/problems/swap-salary/README.md +++ b/problems/swap-salary/README.md @@ -11,10 +11,12 @@ ## 627. Swap Salary (Easy) -Given a table
salary
, such as the one below, that has m=male and f=female values. Swap all f and m values (i.e., change all f values to m and vice versa) with a single update query and no intermediate temp table.
-
-For example:
-
+Given a table salary
, such as the one below, that has m=male and f=female values. Swap all f and m values (i.e., change all f values to m and vice versa) with a single update query and no intermediate temp table.
++For example: + +
+
| id | name | sex | salary | |----|------|-----|--------| @@ -24,6 +26,7 @@ For example: | 4 | D | f | 500 |After running your query, the above salary table should have the following rows: +
| id | name | sex | salary | |----|------|-----|--------| diff --git a/problems/winning-candidate/README.md b/problems/winning-candidate/README.md index 5d1ed68f6..9d98e7071 100644 --- a/problems/winning-candidate/README.md +++ b/problems/winning-candidate/README.md @@ -12,6 +12,7 @@ ## 574. Winning Candidate (Medium)Table:
+Candidate
+-----+---------+ | id | Name | @@ -23,7 +24,9 @@ | 5 | E | +-----+---------++Table:
+Vote
+-----+--------------+ | id | CandidateId | @@ -48,7 +51,10 @@ CandidateId is the id appeared in Candidate table. +------+-Notes:
+Notes:
+-
+- You may assume there is no tie, in other words there will be at most one winning candidate.
-