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]$';
Disclaimer: The content in this post is for educational purposes only. Always remember to take a backup before doing any of the suggested steps just to be on the safe side.
Referral Note: When you purchase through a referral link (if any) on this page, we may earn a commission.
If you're feeling thankful, you can buy me a coffee or a beer