Get the last name of all the customers whose the last name is made up of 4 letters. how can I do it? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Get the last name of all the customers whose the last name is made up of 4 letters. how can I do it?

22nd Jul 2016, 1:45 AM
Rosekamal
5 Answers
+ 2
SELECT LAST NAME FROM TABLE WHERE LENGHT(LAST NAME) =4
22nd Jul 2016, 6:26 AM
PUNEET SINGH
PUNEET SINGH - avatar
0
you can also use like operator with 4 underscore. select last_name from employees where last_name like '____';
22nd Jul 2016, 5:27 PM
Saurabh Joshi
Saurabh Joshi - avatar
0
use % after like condition
22nd Jul 2016, 6:07 PM
Lalit Sharma
Lalit Sharma - avatar
0
length option worked. 4 underscore with Like option didn't work. thanks folks!
24th Jul 2016, 3:30 AM
Rosekamal
0
Roasekamal in which database you tried that? It works in oracle as tested myself.
24th Jul 2016, 5:54 AM
Saurabh Joshi
Saurabh Joshi - avatar