MySQL query sql with specified fields that are not numbers and commas
Core sql statement
MySQL queries statements that do not contain numbers:
SELECT * FROM test WHERE `name` regexp '[^0-9]';
MySQL queries pure numeric statements:
SELECT * FROM test WHERE `name` regexp '[0-9]';
Related articles id, are numbers or commas, then the following statements MySQL query does not contain numbers and commas:
SELECT * FROM test WHERE `name` regexp '[^0-9,]';
MySQL queries a column that is not a number
Columns containing numbers:
SELECT Column Name FROM Table Name WHERE Column Name REGEXP '[0-9]{1,}'
Columns without numbers:
SELECT Column Name FROM Table Name WHERE Column Name REGEXP '[0-9]{1,}' = 0
mysql regular expression query non-numeric
Want to query regular expression sql whose field age content is not numeric
SELECT `age` FROM `table_name` WHERE `age` REGEXP '^[^0-9]$';
or
SELECT `age` FROM `table_name` WHERE `age` NOT REGEXP '^[0-9]$';
more digital
select * from table_name where `age` REGEXP '[^0-9]{1,}'
Introduction to regexp operator in MySQL
The regexp operator is used to perform more complex string comparisons. (Only strings can be manipulated)
Special characters belonging to regexp operator
^Matches the beginning of a string. For example,'^Dong' is a string starting with Dong.
$matches the end of the string.
. Matches any single character including carriage returns and new lines.
* Matches any sequence of 0 or more characters preceding an asterisk. (There may not be one before the asterisk)
+ Matches any sequence of one or more characters preceding the plus sign. (Must be before plus)
?Matches 0 or more characters before the question mark.
{n}A sequence that matches n occurrences of the content preceding the parenthesis.
() matches the contents of the parenthesis.
[abc]Matches the string abc that appears in square brackets.
[a-z]Matches 1 character between a-z in square brackets.
[^a-z] matches 1 character in square brackets that is not between a-z.`
For more information, see this article: www.jb51.net/article/72928.htm