MySQL判斷字符串是否是數(shù)字
來源:懂視網(wǎng)
責(zé)編:小采
時(shí)間:2020-11-09 09:43:08
MySQL判斷字符串是否是數(shù)字
MySQL判斷字符串是否是數(shù)字:查詢表table_name中col_name(字符串類型)的值是數(shù)字的記錄 SELECT col_name,CAST(col_name AS UNSIGNED INTEGER) AS val FROM table_name WHERE col_name=0 OR col_name0 HAVING CHAR_LENGTH(col_name)
導(dǎo)讀MySQL判斷字符串是否是數(shù)字:查詢表table_name中col_name(字符串類型)的值是數(shù)字的記錄 SELECT col_name,CAST(col_name AS UNSIGNED INTEGER) AS val FROM table_name WHERE col_name=0 OR col_name0 HAVING CHAR_LENGTH(col_name)
查詢表table_name中col_name(字符串類型)的值是數(shù)字的記錄 SELECT col_name,CAST(col_name AS UNSIGNED INTEGER) AS val FROM table_name WHERE col_name=0 OR col_name0 HAVING CHAR_LENGTH(col_name)=CHAR_LENGTH(val);
查詢表table_name中col_name(字符串類型)的值是數(shù)字的記錄
SELECT col_name,CAST(col_name AS UNSIGNED INTEGER) AS val
FROM table_name
WHERE col_name="0" OR col_name>0
HAVING CHAR_LENGTH(col_name)=CHAR_LENGTH(val);
聲明:本網(wǎng)頁內(nèi)容旨在傳播知識(shí),若有侵權(quán)等問題請(qǐng)及時(shí)與本網(wǎng)聯(lián)系,我們將在第一時(shí)間刪除處理。TEL:177 7030 7066 E-MAIL:11247931@qq.com
MySQL判斷字符串是否是數(shù)字
MySQL判斷字符串是否是數(shù)字:查詢表table_name中col_name(字符串類型)的值是數(shù)字的記錄 SELECT col_name,CAST(col_name AS UNSIGNED INTEGER) AS val FROM table_name WHERE col_name=0 OR col_name0 HAVING CHAR_LENGTH(col_name)