Weather Observation Station 5

Sort by

recency

|

7261 Discussions

|

  • + 0 comments
    select
    city,
    char_length(city)
    from STATION
    where city =
        (select
            city
        from STATION
        where char_length(city) = 
            (select min(char_length(city))
            from STATION order by city)
        order by city
        limit 1)
    or city =
        (select
            city
        from STATION
        where char_length(city) = 
            (select max(char_length(city))
            from STATION order by city)
        order by city
        limit 1);
    
  • + 0 comments

    with base as ( select city, LENGTH(city) as size, row_number() over (partition by LENGTH(city) order by city) as row_id
    from station where LENGTH(city) = (select max(LENGTH(city)) from station) or LENGTH(city) = (select min(LENGTH(city)) from station) order by LENGTH(city) desc, city asc ) select city,size from base where row_id=1

  • + 0 comments
    (
        SELECT CITY, LENGTH(CITY) AS city_length 
        FROM STATION 
        ORDER BY city_length, CITY ASC
        LIMIT 1
    )
    UNION
    (
        SELECT CITY, LENGTH(CITY) AS city_length 
        FROM STATION 
        ORDER BY city_length DESC, CITY ASC 
        LIMIT 1
    )
    
  • + 0 comments
    (
      SELECT CITY, CHAR_LENGTH(CITY) AS NAME_LENGTH
      FROM STATION
      WHERE CHAR_LENGTH(CITY) = (
          SELECT MIN(CHAR_LENGTH(CITY)) FROM STATION
      )
      ORDER BY CITY
      LIMIT 1
    )
    UNION ALL
    (
      SELECT CITY, CHAR_LENGTH(CITY) AS NAME_LENGTH
      FROM STATION
      WHERE CHAR_LENGTH(CITY) = (
          SELECT MAX(CHAR_LENGTH(CITY)) FROM STATION
      )
      ORDER BY CITY
      LIMIT 1
    );
    
  • + 0 comments

    -- City with the shortest name SELECT TOP 1 CITY, LEN(CITY) AS NAME_LENGTH FROM STATION ORDER BY LEN(CITY), CITY;

    -- City with the longest name SELECT TOP 1 CITY, LEN(CITY) AS NAME_LENGTH FROM STATION ORDER BY LEN(CITY) DESC, CITY;