1.DDL语句
CREATE TABLE `student` (
`id` int(11) NOT NULL AUTO_INCREMENT COMMENT '学号',
`createDate` datetime DEFAULT NULL,
`userName` varchar(20) DEFAULT NULL,
`pwd` varchar(36) DEFAULT NULL,
`phone` varchar(11) DEFAULT NULL,
`age` tinyint(3) unsigned DEFAULT NULL,
`sex` char(2) DEFAULT NULL,
`introduce` varchar(255) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=22 DEFAULT CHARSET=utf8;
2.DML语句
insert into student values(0,'2024-02-25 10:10:10','盘古',
'123456','15685647598',255,'神','开天辟地第一人');
insert into student values(0,'2024-02-25 10:10:10','女娲',
'123456','15685647598',255,'女','多次造人最终成功');
insert into student values(0,'2024-02-25 10:10:10','伏羲',
'123456','15685647598',255,'神','先天八卦');
insert into student values(0,'2024-02-25 10:10:10','神农',
'123456','15685647598',255,'男','尝百草,死于断肠草下');
insert into student values(0,'2024-02-25 10:10:10','祖',
'123456','15685647598',255,'神','教会百姓养蚕织布');
insert into student values(0,'2024-02-25 10:10:10','蚩尤',
'123456','15685647598',255,'男','锻造大神,坐下食铁巨兽');
insert into student(userName,age,introduce)values('仓颉',125,'中国形象文字');
3.DQL语句
SELECT*FROM `student` where introduce like '%人%';
select*from student where pwd is null;
select*from student where pwd is not null;
select*from student where age between 150 and 200;
select*from student where createDate between '2024-02-21 00:00:00' and '2024-02-23 00:00:00';
select*from student where userName in('盘古','伏羲','蚩尤');