w3resource

Oracle: List the names of those employees whose first name has only five characters

Oracle Wildcard special Operator: Exercise-4 with Solution

Write a query to list the names (first and last) of those employees whose first name has only five characters.

Sample table : employees


Sample Solution:

Oracle Code:

SELECT  first_name, last_name  
FROM employees 
WHERE length(first_name) = 5;

Output:


FIRST_NAME           LAST_NAME
-------------------- -------------------------
Ellen                Abel
Mozhe                Atkinson
David                Austin
Sarah                Bell
David                Bernstein
Laura                Bissot
Kelly                Chung
Karen                Colmenares
Julia                Dellinger
Bruce                Ernst
Kevin                Feeney
Nancy                Greenberg
Peter                Hall
Vance                Jones
Payam                Kaufling
Neena                Kochhar
James                Landry
David                Lee
Diana                Lorentz
Jason                Mallin
James                Marlow
Susan                Mavris
Allan                McEwen
Irene                Mikkilineni
Kevin                Mourgos
Julia                Nayer
Karen                Partners
Valli                Pataballa
Hazel                Philtanker
Sigal                Tobias
Peter                Tucker
Peter                Vargas
Clara                Vishney
Alana                Walsh
Eleni                Zlotkey

35 rows selected.

Pictorial Presentation:

Pictorial: List the names of those employees whose first name has only five characters

Improve this sample solution and post your code through Disqus.

Previous: Write a query to list the names (first and last) of those employees whose name have second alphabet 's' in their names.
Next: Write a query to list the names (first and last) of those employees whose first name has only five characters and starts with ‘A’.

What is the difficulty level of this exercise?



Follow us on Facebook and Twitter for latest update.