第八章用通配符进行过滤

来源:互联网 发布:面向对象编程的优点 编辑:程序博客网 时间:2024/05/24 06:51
-- 假如有一张学生表 Id sname score ccid
create table student
(
 id int auto_increment,
 name varchar(10),
 age int,
 date varchar(20),
 primary key(id)
)engine=innodb;


select sname , score from student where sname like 'wpq%';
-- %可以匹配除null之外的任意值 查询
select sname , score from student where sname like 'null';
-- %匹配不了null
select sname , score from student where sname like 'w_q_';
-- _是一个占位符能匹配除null任意字 只能代替一个位置 出现两次就是两个位置
select concat(sname,score)  pj from student;
0 0
原创粉丝点击