Was wondering if it’s possible to select something that has more/less than x characters in SQL.
For example, I have an employee table and I want to show all employee names that has more than 4 characters in their name.
Here’s an example table
ID EmpName Dept
1 Johnny ACC
2 Dan IT
3 Amriel PR
4 Amy HR
If you are using SQL Server, Use the
LEN(Length) function:MSDN for it states:
Here’s the link to the MSDN
For oracle/plsql you can use
Length(), mysql also uses Length.Here is the Oracle documentation:
http://www.techonthenet.com/oracle/functions/length.php
And here is the mySQL Documentation of
Length(string):http://dev.mysql.com/doc/refman/5.1/en/string-functions.html#function_length
For PostgreSQL, you can use
length(string)orchar_length(string). Here is the PostgreSQL documentation:http://www.postgresql.org/docs/current/static/functions-string.html#FUNCTIONS-STRING-SQL