Skip to content

Commit

Permalink
Create find-cities-in-each-state.sql
Browse files Browse the repository at this point in the history
  • Loading branch information
kamyu104 authored Jun 27, 2024
1 parent 0b73f7c commit 4c95890
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions MySQL/find-cities-in-each-state.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Time: O(nlogn)
# Space: O(n)

SELECT state, GROUP_CONCAT(city ORDER BY city SEPARATOR ', ') AS cities
FROM cities
GROUP BY 1
ORDER BY 1;

0 comments on commit 4c95890

Please sign in to comment.