Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR SQL

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)
 
PREVIOUS NEXT
Tagged: #sql #finding #longest #shortest #names #fleld
ADD COMMENT
Topic
Name
3+6 =