1学生表DDL
CREATE TABLE `student` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`createdate` datetime DEFAULT NULL,
`username` varchar(20) DEFAULT NULL,
`pwd` varchar(36) DEFAULT NULL,
`phone` varchar(11) DEFAULT NULL,
`age` tinyint(3) DEFAULT NULL,
`sex` char(2) DEFAULT NULL,
`introduce` varchar(255) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8;
2插入学生信息DML
INSERT into student values(0,'2024-02-25 10:00:00','赵玲','123','15683440435',16,'女','逍遥');
INSERT into student values(0,'2024-02-25 10:00:00','王语嫣','123','15683440435',17,'女','木芙蓉');
INSERT into student values(0,'2024-02-25 10:00:00','龙姑娘','123','15683440435',22,'女','好好过日子');
INSERT into student values(0,'2024-02-25 10:00:00','杨过','123','15683440435',18,'男','一场杨过误终身');
INSERT into student values(0,'2024-02-25 10:00:00','杨瑶','123','15683440435',27,'男','大儿子');
INSERT into student(username,age,introduce) values('黄衣女子',26,'大女儿');
效果展示
3基础查询测试DQL
SELECT * FROM student;
select username '姓名',age '年龄',sex '性别',introduce '介绍'
from student
where pwd is not null;
#从第四条(3+1)开始查询,查两条
select * from student limit 3,2;
#order by根据数据类型进行排序会更加准确
select * from student ORDER BY age desc limit 3;
select DISTINCT sex '性别类型' from student;
标签:00,DEFAULT,into,values,student,MySQL,NULL
From: https://blog.csdn.net/2401_83871495/article/details/137008952