Search
 
SCRIPT & CODE EXAMPLE
 

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)
Comment

how to print longest name in sql

select top 1 Name, len(Name) as city_length from tblPerson order by city_length desc
Comment

PREVIOUS NEXT
Code Example
Sql :: oracle database connection visual studio 2019 
Sql :: plsql check how much space all databases are consuming 
Sql :: How to calculate average of average salary of departments? 
Sql :: get all jobs if salary more than 5500 less than 10000 sql 
Sql :: Get top 1 row of each group 
Sql :: if new such record in where condition in sql so what is return 
Sql :: Having trouble running COUNT in my INSERT INTO statement 
Sql :: providername system.data. mysql 
Sql :: postgres row expiration 
Sql :: nuget sqllite-net-pcl 
Sql :: SQL Combining Multiple Operators 
Sql :: mysql get last character of string 
Sql :: mysql let join 
Sql :: minecraft duping allowed servers 
Sql :: Laravel: customize or extend notifications - database model 
Sql :: run all sql file from folder postgres command line 
Sql :: change redo log file size in mysql 5.6 
Sql :: create-table-with-index-organization 
Sql :: valadate mysql 
Sql :: 2020 new year 
Sql :: mostrar datos de tablas relacionadas mysql kjava 
Sql :: how to change oracle sid name in 19c database 
Sql :: remove record from table sql 
Sql :: c# execute transact sql 
Sql :: classement rang mysql 7 
Sql :: mysql join table with a text columns with ids splited by char 
Sql :: sqlite query timer 
Sql :: to_sql id colymn 
Sql :: SQL LEFT JOIN With AS Alias 
Sql :: what is a foriegn key 
ADD CONTENT
Topic
Content
Source link
Name
5+5 =