Weather Observation Station 5

Sort by

recency

|

7256 Discussions

|

  • + 0 comments

    select city,length(city) From station ORDER BY length(city),city LIMIT 1;

    select city,length(city) From station ORDER BY length(city) DESC,city LIMIT 1;

  • + 1 comment

    SELECT CITY, LENGTH(CITY) AS LEN FROM STATION ORDER BY LEN ASC, CITY ASC LIMIT 1; SELECT CITY, LENGTH(CITY) AS LEN FROM STATION ORDER BY LEN DESC, CITY ASC LIMIT 1;

  • + 1 comment

    (select city,length(city) from station order by length(city),city limit 1) UNION (select city,length(city) from station order by length(city) desc,city limit 1)

  • + 0 comments

    with cte as( select city, row_number() over(order by length(city), c``ity) as rn from station ) select city, length(city) from cte where rn =1 or rn = (select max(rn) from cte)

  • + 0 comments

    ------MySQL

    This will solve the problem in single query using window function

    With CTE as (SELECT city,length(city),row_number() over (order by length(city) desc,city ) as rw from Station Union SELECT city,length(city),row_number() over (order by length(city),city ) as rw from Station )

    select city,length(city) from CTE where rw =1