mySQL创建数据库需要自行创建,
数据库名称可以为【schoolDB】,字符集【utf8】,排列规则【utf8_general_ci】,2
1、学生表DDL
CREATE TABLE `student` (
`id` int(11) NOT NULL AUTO_INCREMENT COMMENT '学号',
`creatDate` 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 '男',
`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-24 10:00:00','赵灵儿','123','12312345678',11,'女','逍遥哥哥,你终于找到我了。');
insert into student values(0,'2024-02-24 10:00:00','王语嫣','123','12312345678',11,'女','我和你不共戴天。');
insert into student values(0,'2024-02-24 10:00:00','龙姑娘','123','12312345678',11,'女','过儿。');
insert into student values(0,'2024-02-24 10:00:00','李莲花','123','12312345678',11,'男','武功很厉害。');
insert into student values(0,'2024-02-24 10:00:00','杨过','123','12312345678',11,'男','一遇杨过误终身。');
insert into student values(0,'2024-02-24 10:00:00','黄衣女子','123','12312345678',11,'女','杨过与龙姑娘的大女儿。');
insert into student values(0,'2024-02-24 10:00:00','杨逍','123','12312345678',11,'女','杨过跟程英的大儿子。');
3、基础查询测试DQL
select * from student;
select userName as 姓名,age '年龄',sex '性别',introduce '简介'
from student
where pwd is not null;
select * from student limit 3,2;
select * from student order by age desc limit 3;
select distinct sex '性别类型' from student;
标签:11,00,DEFAULT,into,DML,123,student,DDL,DQL
From: https://blog.csdn.net/H18703199283/article/details/137009044