We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
Weather Observation Station 5
Weather Observation Station 5
Sort by
recency
|
7097 Discussions
|
Please Login in order to post a comment
SELECT TOP 1 CITY, LEN (CITY) FROM STATION WHERE LEN(CITY) = ( SELECT MIN(LEN(CITY)) FROM STATION) ORDER BY CITY ASC
SELECT TOP 1 CITY, LEN (CITY) FROM STATION WHERE LEN(CITY) = ( SELECT MAX(LEN(CITY)) FROM STATION) ORDER BY CITY ASC
I love how SQL lets you work with complex data sets in such a clean, readable way. betguru 247 net register
MYSQL
select city, length(city) from station where length(city) in ( select min(length(city)) from station ) ORDER BY city asc limit 1; select city, length(city) from station where length(city) in ( select max(length(city)) from station ) ORDER BY city asc limit 1;
MySQL ----->
SELECT CITY, LENGTH(CITY) FROM STATION ORDER BY LENGTH(CITY)ASC, CITY LIMIT 1; SELECT CITY, LENGTH(CITY) FROM STATION ORDER BY LENGTH(CITY)DESC, CITY LIMIT 1 `
In MS SQL Server
select Top 1 city,len(city) as f from station ORDER BY f ASC , city ASC; select Top 1 city,len(city) as f from station ORDER BY f desc, city DESC;
In DB2
Select city,length(city) as name from station ORDER BY name, city asc fetch first 1 row only; Select city,length(city) as name from station ORDER BY name desc,city desc fetch first 1 row only;