LIKE 操作
作者:互联网
建表1:
CREATE TABLE student(
Sno char(15) NOT NULL,
Sname char(20) NULL,
Ssex char(2) NULL,
Sage smallint NULL,
Sdept char(20) NULL
)
INSERT student (Sno, Sname, Ssex, Sage, Sdept) VALUES ('2012000', '李一平', '男', '18', 'IS')
INSERT student (Sno, Sname, Ssex, Sage, Sdept) VALUES ('2012111', '张立', '男', '19', 'IS')
INSERT student (Sno, Sname, Ssex, Sage, Sdept) VALUES ('2012222', '刘晨', '女', '19', 'CS')
INSERT student (Sno, Sname, Ssex, Sage, Sdept) VALUES ('2012333', '王敏', '女', '18', 'MA')
INSERT student (Sno, Sname, Ssex, Sage, Sdept) VALUES ('2012444', '李勇', '男', '20', 'CS')
INSERT student (Sno, Sname, Ssex, Sage, Sdept) VALUES ('201255555', '张琴', '女', '19', 'CS')
INSERT student (Sno, Sname, Ssex, Sage, Sdept) VALUES ('201266666', '王方', '女', '20', 'MA')
INSERT student (Sno, Sname, Ssex, Sage, Sdept) VALUES ('3415798', '小白', '男', '21', 'IS')
LIKE 操作
like 与 where 使用,作条件限制 ,模糊查询,
语法:SELECT 字段,* FROM 表名 WHERE 字段 LIKE 条件;
例子:
语法:SELECT 字段,* FROM 表名 WHERE 字段 not LIKE 条件;
例子:
标签:Sname,LIKE,Sno,Sage,Ssex,Sdept,student,操作 来源: https://blog.csdn.net/qq_42064309/article/details/100658728