当前位置:网站首页>Complete review (including syntax) -- MySQL regular expressions
Complete review (including syntax) -- MySQL regular expressions
2022-06-26 01:25:00 【Mixed with bean curd and】
Complete review of regular expressions ( Including grammar )
– Regular expression data is from the previous chapter MyBingSchool In the library
use MyBingSchool;
– Student information sheet
SELECT * FROM Student;
– Subject list
select * from Cuosre;
– Score table
select * from Sorce;
– Teachers list
select * from Teacher;
– Regular expressions Operation cases
– ^ Matches the start of the input string With 1 Starting data
select s_brith as ' date of birth ' from student WHERE s_brith REGEXP '^1' ORDER BY s_brith ;
– ^ Matches the end of the input string With 9 Starting data
-- select s_sroce as ' fraction ' from Sorce WHERE s_sroce REGEXP '^9' ORDER BY s_sroce ;
select s_sroce as ' fraction ' from Sorce WHERE s_sroce REGEXP '9$' ORDER BY s_sroce ;
select s_name as ' full name ' from student WHERE s_name REGEXP ' Four $' ORDER BY s_name;
select s_name as ' full name ' from student WHERE s_name REGEXP '^[ Zhang ]| Two &' ORDER BY s_name;
– . Match any character .9 Here match any containing 9 The data of
select s_brith as ' date of birth ' from student WHERE s_brith REGEXP '.9' ORDER BY s_brith;
– .4 Here match any containing 4 The data of
select s_brith as ' date of birth ' from student WHERE s_brith REGEXP '.4' ORDER BY s_brith;
– | And ‘or’ similar perhaps Match, so
select s_name as ' full name ' from student WHERE s_name REGEXP ' Zhang San | The king 2 | Li Si ' ORDER BY s_name;
– Lookup table with 199 1996 1998 The data of ‘’=LIKE It has the function of fuzzy query conditions
select s_brith as ' date of birth ' from student WHERE s_brith REGEXP '199' ORDER BY s_brith ;
select s_brith as ' date of birth ' from student WHERE s_brith REGEXP '1996' ORDER BY s_brith ;
select s_brith as ' date of birth ' from student WHERE s_brith REGEXP '1998' ORDER BY s_brith ;
– Combine [] Matching condition | perhaps
select s_brith as ' date of birth ' from student WHERE s_brith REGEXP '199[6|8]' ORDER BY s_brith ;
– * Match previous subexpression zero or more times * Equivalent to {0,}
select s_brith as ' date of birth ' from student WHERE s_brith REGEXP '1*' ORDER BY s_brith ;
– Match previous subexpression one or more times + Equivalent to {1,}
select s_brith as ' date of birth ' from student WHERE s_brith REGEXP '1+' ORDER BY s_brith ;
– Combine ^ + Use
select s_sroce as ' fraction ' from Sorce WHERE s_sroce REGEXP '^9+' ORDER BY s_sroce ;
– {n} n Is a non negative integer . Matched definite n Time 9{2}
select s_brith as ' date of birth ' from student WHERE s_brith REGEXP '9{2}' ORDER BY s_brith ;
– {n,m} m and n All non negative integers among n <= m Least match n Times and at most m Time
– Insert data for easy demonstration {n,m}
INSERT INTO student VALUES (DEFAULT,' Liu tao ',' Woman ','1999-01-11');
– Auto increment cannot be used without setting default
– Modify the insert data according to the name
UPDATE student set s_id='06' WHERE s_name=' Liu tao ';
INSERT INTO student VALUES ('07',' Wang Tao ',' Woman ','1999-02-22');
INSERT INTO student VALUES ('08',' Xiao Xiao ',' Woman ','1888-08-18');
select s_brith as ' date of birth ' from student WHERE s_brith REGEXP '9{1,3}' ORDER BY s_brith ;
select s_brith as ' date of birth ' from student WHERE s_brith REGEXP '9{2,3}' ORDER BY s_brith ;
边栏推荐
- JSON基本语法
- 黑盒测试 — 测试用例 之 判定表法看这一篇就够了
- WIN10系统C盘清理策略
- 在FreeBSD中安装MySQL数据库
- Comment promouvoir efficacement les produits
- QT cmake pure C code calls the system console to input scanf and Chinese output garbled code
- Case: drawing Matplotlib dynamic graph
- Radio boxes are mutually exclusive and can be deselected at the same time
- 关于EF翻页查询数据库
- Multiple interface calls, using promise all、Promise. Race and promise any
猜你喜欢

Optimized three-dimensional space positioning method and its fast implementation in C language

使用Gin框架运行Demo时报错“ listen tcp :8080: bind: An attempt was made to access a socket in a way forbidden”

C # operate with MySQL

Technical introduction - detailed explanation of chip manufacturing process

Zhihuijia - full furniture function

Design and process analysis of anti backflow circuit for MOS transistor

从查询数据库性能优化谈到redis缓存-谈一谈缓存的穿透、雪崩、击穿

Download and install flume

LabVIEW开发监控聚变实验脉冲电源

Etcd database source code analysis cluster communication initialization
随机推荐
A sharp tool for information collection, Google hacker syntax
Return value is object type method call equals()
计算机网络知识总结(面试)
Sword finger offer II 096 String interleaving
[机缘参悟-30]:鬼谷子-内揵篇-同理心,站在对方的立场,拉近与对方的心理距离
How to effectively promote products
【Visual Studio Code】vscode快捷键大全
WIN10系统C盘清理策略
C thread pool control semaphore
FIFO code implemented in C language
“热帖”统计
Solution to MySQL error code 2003
Flex & Bison 开始
2022年电气试验考试试题模拟考试平台操作
New library launched | cnopendata China new house information data
STM32GPIO
Design and process analysis of anti backflow circuit for MOS transistor
[excel knowledge and skills] Excel data type
黑盒测试 — 测试用例 之 判定表法看这一篇就够了
Idea configuration