Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 9e9fbaa

Browse files
1 parent f8b126f commit 9e9fbaa

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

‎SQL/weather-observation-station-5.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,12 @@ https://www.hackerrank.com/challenges/weather-observation-station-5/problem?isFu
33

44
The text is a SQL query that asks for the two cities in a table named STATION with the shortest and longest names, and their respective lengths. The query also specifies that if there are ties, the city that comes first in alphabetical order should be selected.
55

6+
```sql
7+
(select city, length(city) from station order by length(city), city limit 1)
8+
union
9+
(select city, length(city) from station order by length(city) desc, city limit 1);
10+
```
11+
612
--------------
713

814
There are different ways to write this query in SQL, depending on the database system and the syntax it supports. Here are some possible solutions:

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /