schooldb库——utf8字符集——utf8_general_ci排序规则
先创建库,再去使用下列的DDL语句。
CREATE TABLE `student` (
`id` int(11) NOT NULL AUTO_INCREMENT COMMENT '学号',
`createDate` datetime DEFAULT NULL COMMENT '创建时间',
`modifyDate` datetime DEFAULT NULL COMMENT '修改时间',
`userName` varchar(30) NOT NULL COMMENT '学生名称',
`pwd` varchar(36) DEFAULT NULL COMMENT '密码',
`phone` varchar(11) DEFAULT NULL COMMENT '手机号',
`age` tinyint(3) unsigned DEFAULT NULL COMMENT '年龄',
`sex` char(2) DEFAULT '男' COMMENT '性别',
`className` varchar(20) DEFAULT NULL,
`addRess` varchar(255) DEFAULT NULL COMMENT '地址',
`introduce` varchar(255) DEFAULT NULL COMMENT '简介',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
学生表DML
INSERT INTO `student` VALUES ('1', '2023-09-16 09:22:22', '2024-04-15 10:12:12', '张三', '123456', '15612345678', '19', '男', '信息1班', '石家庄', '一首张三的歌送给大家');
INSERT INTO `student` VALUES ('2', '2023-09-17 09:22:22', '2024-04-15 08:11:12', '李四', '123156', '15612345178', '19', '女', '信息1班', '石家庄', '一曲美丽的舞蹈送给大家');
INSERT INTO `student` VALUES ('3', '2023-09-18 09:23:22', '2024-04-15 11:12:12', '王五', '123256', '15612345278', '20', '男', '信息2班', '沈阳', '大刀王五也是英雄');
INSERT INTO `student` VALUES ('4', '2023-09-19 09:24:22', '2024-04-15 12:13:12', '赵六', '123356', '15612345378', '18', '男', '信息1班', '甘肃', '六六大顺');
INSERT INTO `student` VALUES ('5', '2023-09-10 09:25:22', '2024-04-15 13:14:12', '阮小七', '143456', '15612345678', '19', '男', '信息2班', '石家庄', '阮氏三雄,小七最霸气');
INSERT INTO `student` VALUES ('6', '2023-09-21 09:26:22', '2024-04-15 14:15:12', '朱重八', '153456', '15612355678', '18', '男', '信息2班', '浙江', '开局一个碗。');
INSERT INTO `student` VALUES ('7', '2023-09-22 09:27:22', '2024-04-15 15:16:12', '苏老九', '163456', '15612365678', '20', '男', '信息2班', '石家庄', '武状元');
INSERT INTO `student` VALUES ('8', '2023-09-23 09:28:22', '2024-04-15 16:17:12', '王石', '123476', '15612345778', '22', '男', '信息1班', '徐蚌', '钻石王老五');
INSERT INTO `student` VALUES ('9', '2023-09-24 19:29:22', '2024-04-15 17:18:12', '萧十一', '128456', '15612385678', '21', '男', '信息1班', '石家庄', '帅气逼人,英雄也。');
INSERT INTO `student` VALUES ('10', '2023-09-25 09:20:22', '2024-04-15 18:19:12', '宫十二', '129456', '15612395678', '22', '女', '信息1班', '杭州', '十二条舔狗和一位绿茶的故事');
将赵六后面后面的学生查出来
select createDate from student WHERE username="赵六";
SELECT * FROM student
WHERE createDate>
(
SELECT createDate from student WHERE username="赵六"
);