CREATE TABLE `student` (
`id` int(11) NOT NULL AUTO_INCREMENT COMMENT '学号',
`createDate` datetime DEFAULT NULL COMMENT '创建时间',
`userName` varchar(20) DEFAULT NULL COMMENT '姓名',
`pwd` varchar(36) DEFAULT NULL COMMENT '密码',
`phone` varchar(11) DEFAULT NULL COMMENT '手机号',
`age` tinyint(3) DEFAULT NULL COMMENT '年龄',
`sex` char(2) DEFAULT NULL COMMENT '性别',
`introduce` varchar(255) DEFAULT NULL COMMENT '简介',
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=25 DEFAULT CHARSET=utf8;
2、插入数据——DML语句
insert into student values
(0,'2022-02-02 10:00:00','葫芦爷爷','123321','12332154687',69,'男','葫芦娃的爷爷,在穿山甲的帮助下找到了葫芦籽,种下了葫芦娃。');
insert into student values
(0,'2022-02-02 10:00:00','蛇精','123321','12333154687',29,'女','如新如意顺我心意,快快显灵,快快显灵。');
insert into student values
(0,'2022-02-02 10:00:00','蜈蚣精','123321','12333154687',69,'男','被三娃提成了好多段。');
insert into student values
(0,'2022-02-02 10:00:00','葫芦小金刚','123321','12332154687',17,'男','与蝴蝶妹妹有了一段孽缘。');
insert into student values
(0,'2022-02-02 10:00:00','六娃','123321','12332154687',19,'男','我是谁我在那。');
insert into student values
(0,'2022-02-02 10:00:00','二娃','123321','12332154687',9,'男','眼中钉,歪风邪道。');
insert into student (userName,age,introduce) values ('山神',255,'孕育了葫芦娃种子');
![](https://img-blog.csdnimg.cn/direct/c73134015f5549edaee00de2ba3f0c47.png)
3、运用模糊查询——like,between, in
select * from student where introduce like '%。';
select * from student where age like '%5';
select * from student where age between 150 and 200;
select * from student where createDate between '2024-02-09 10:10:10' and '2024-02-25 10:10:10';
select * from student where createDate > '2024-02-09 10:10:10' and createDate<'2024-02-25 11:10:10';
select * from student where userName in ('女娲','蚩尤','伏羲');
select * from student where userName not in ('女娲','蚩尤','伏羲');