基本查询语句:-2027.3.30MySQL 基础查询语句 - 其中_下划线代表匹配任意单个字符
基础查询语句
SELECT * FROM student
加上筛选
where
筛选对应的列
studentName like ‘%C%’;
开头字母必须是C开头的·或以某结尾
SELECT * FROM student where studentName like ‘C%’;
SELECT * FROM student where studentName like ‘%z’;
中间的
SELECT * FROM student where studentName like ‘% C%’; 拼多多帮助力入口
做文字长度筛选
select * from student where national like ‘_’ or
national like ‘__’;
其中_下划线代表匹配任意单个字符
其中%百分号代表匹配任意长度字符
使用正则表达式查询5月和9月过生日的人员列表,返回sql
select * from student where 正则筛选
AI返回SQL如下:
– 匹配生日字段中 月份为 05 或 09 / 5 或 9 的所有学生
SELECT * FROM student
WHERE birthday REGEXP ‘-(0?5|0?9)-’;