student建表
DDL语句
DROP TABLE IF EXISTS `student`;
CREATE TABLE `student` (
`id` int(11) NOT NULL AUTO_INCREMENT COMMENT '学号',
`createDate` datetime(0) NULL DEFAULT NULL COMMENT '创建时间',
`userName` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '用户名',
`pwd` varchar(36) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '密码',
`phone` varchar(11) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '手机号',
`age` tinyint(3) UNSIGNED NULL DEFAULT NULL COMMENT '年龄',
`sex` char(2) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '性别',
`introduce` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '简介',
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 10 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic;
DML语句
INSERT INTO `student` VALUES (3, '2024-02-21 10:10:10', '盘古', '123456', '12345678912', 255, '神', '开天辟地第一人。');
INSERT INTO `student` VALUES (4, '2024-02-25 10:10:10', '女娲', '123456', '12345678912', 200, '神', '开天辟地第一人。');
INSERT INTO `student` VALUES (5, '2024-02-22 10:10:10', '牛魔', '123456', '12345678912', 215, '神', '开天辟地第一人。');
INSERT INTO `student` VALUES (6, '2024-02-23 10:10:10', '神农', '123456', '12345678912', 155, '神', '开天辟地第一人。');
INSERT INTO `student` VALUES (7, '2024-02-25 10:10:10', '伏羲', '123456', '12345678912', 115, '神', '开天辟地第一人。');
INSERT INTO `student` VALUES (8, '2024-02-25 10:10:10', '蚩尤', '123456', '12345678912', 155, '神', '开天辟地第一人。');
INSERT INTO `student` VALUES (9, NULL, '仓颉', NULL, NULL, 125, NULL, '中国象形文字');
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 ('盘古','伏羲','蚩尤');