Category: MySQL
How to Find a MySQL/MariaDB column that has a numeric value.
Is your app maybe using a text field that may have the numbers, letters text but now you want to search for results that have a column that has a numeric value or specifically 0 or 1.
You can use the SQL query define if it the column has a numeric value.
In this example we'll be querying the WordPress post meta database table.
SELECT * FROM `wp_postmeta` WHERE meta_value REGEXP '^[0-9]$';
How to Find a MySQL/MariaDB column that has a zero value use the SQL query.
SELECT * FROM `wp_postmeta` WHERE meta_value REGEXP '^[0]$';
How to Find a MySQL/MariaDB column that has a value of 1 use this SQL query.
SELECT * FROM `wp_postmeta` WHERE meta_value REGEXP '^[1]$';