1200字范文,内容丰富有趣,写作的好帮手!
1200字范文 > mysql学习–mysql必知必会1【MySQL】

mysql学习–mysql必知必会1【MySQL】

时间:2018-06-28 01:05:11

相关推荐

mysql学习–mysql必知必会1【MySQL】

数据库|mysql教程

关键字,表达式,mysql,where

数据库-mysql教程

如下为mysql必知必会第九章开始:

彩虹全解密源码,vscode横线怎么做,ubuntu 开机执行,tomcat项目没启动,爬虫 工具 nutch,php接口session,seo系统优化有哪些方法,手游分发网站源码,手机网站模板html源码下载lzw

正则表达式用于匹配特殊的字符集合。mysql通过where子句对正则表达式提供初步的支持。

yy电影网站源码程序,vscode一键编译c,ubuntu内核删除,tomcat短域名访问,scrapy 爬虫源码,php endfor,汕头市seo网络推广企业lzw

关键字regexp用来表示后面跟的东西作为正则表达式处理。

文件上传和下载系统源码,树莓派 虚拟 Ubuntu,狗屁股爬虫子,php剔除标签,seo_sexo少女lzw

(.)是正则表达式的一个符号,表示匹配任意一个字符:

mysql> select prod_name-> from products-> where prod_name regexp .000-> order by prod_name;+--------------+| prod_name|+--------------+| JetPack 1000 || JetPack 2000 |+--------------+2 rows in set (0.14 sec)

|匹配符:

表示匹配其中之一

mysql> select prod_name-> from products-> where prod_name REGEXP 1000|2000-> ORDER BY prod_name;+--------------+| prod_name|+--------------+| JetPack 1000 || JetPack 2000 |+--------------+2 rows in set (0.00 sec)

[]匹配符: 匹配几个字符之一

2 rows in set (0.00 sec)mysql> select prod_name-> from products-> where prod_name regexp [123] Ton-> ;+-------------+| prod_name |+-------------+| 1 ton anvil || 2 ton anvil |+-------------+2 rows in set (0.00 sec)

mysql> select prod_name from products where prod_name regexp [1-5] Ton;+--------------+| prod_name|+--------------+| .5 ton anvil || 1 ton anvil|| 2 ton anvil|+--------------+3 rows in set (0.02 sec)

mysql> select prod_name from products where prod_name regexp [^1-3] Ton;+--------------+| prod_name|+--------------+| .5 ton anvil |+--------------+1 row in set (0.00 sec)

匹配特殊字符,必须用//为前导。

mysql> select prod_name from products where prod_name regexp //. ;+--------------+| prod_name|+--------------+| .5 ton anvil |+--------------+1 row in set (0.00 sec)

匹配字符类:

mysql> select prod_name from products where prod_name REGEXP //([0-9] sticks?//) order by prod_name;+----------------+| prod_name|+----------------+| TNT (1 stick)|| TNT (5 sticks) |+----------------+2 rows in set (0.05 sec)mysql> select prod_name from products where prod_name REGEXP [[:digit:]]{4} order by prod_name;+--------------+| prod_name|+--------------+| JetPack 1000 || JetPack 2000 |+--------------+2 rows in set (0.00 sec)

定位符用法:

mysql> select prod_name-> from products-> where prod_name REGEXP ^[0-9//.]-> order by prod_name;+--------------+| prod_name|+--------------+| .5 ton anvil || 1 ton anvil|| 2 ton anvil|+--------------+3 rows in set (0.00 sec)

以上都是mysql正则表达式的用法。

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。