Skip
Arish's avatar

110. Ordering by LENGTH


Sort by String Length

sql
1SELECT name FROM students
2ORDER BY LENGTH(name);

Shortest names first.

Descending

sql
1SELECT name FROM students
2ORDER BY LENGTH(name) DESC;