Please note, this is a STATIC archive of website www.w3resource.com from 19 Jul 2022, cach3.com does not collect or store any user information, there is no "phishing" involved.
w3resource

PostgreSQL Basic SELECT Statement: Check whether the first_name column of the employees containing any number


17. Write a query to check whether the first_name column of the employees table containing any number.

Sample Solution:

Code:

SELECT * 
FROM employees 
WHERE  first_name 
SIMILAR TO   '%0|1|2|3|4|5|6|7|8|9%';

Sample table: employees


Output:

 employee_id | first_name | last_name | email | phone_number | hire_date | job_id | salary | commission_pct | manager_id | department_id
-------------+------------+-----------+-------+--------------+-----------+--------+--------+----------------+------------+---------------
(0 rows)

Practice Online



Have another way to solve this solution? Contribute your code (and comments) through Disqus.

Previous: Write a query to get the first name, last name and the length of the name, including first_name and last_name of all the employees from employees table.
Next: Write a query to select first ten records from a table.

What is the difficulty level of this exercise?