Answers for "sql find longest and shortest name"

SQL
2

sql finding longest and shortest names in a fleld

# IN the example below, "CITY" is the filed, "STATION" is the Table
(SELECT CITY, LENGTH(CITY)
FROM STATION
ORDER BY LENGTH(CITY) ASC, CITY ASC LIMIT 1)
UNION
(SELECT CITY, LENGTH(CITY)
FROM STATION
ORDER BY 
LENGTH(CITY) DESC, CITY DESC LIMIT 1)
Posted by: Guest on July-06-2020
0

how to print longest name in sql

select top 1 Name, len(Name) as city_length from tblPerson order by city_length desc
Posted by: Guest on June-29-2021

Code answers related to "sql find longest and shortest name"

Code answers related to "SQL"

Browse Popular Code Answers by Language