前言
数据库名称可以为【jiao】,字符集【utf8】,排序规则【utf8-general_cl】。
1.建表语句-DDL
CREATE TABLE `xxx` (
`id` int(11) DEFAULT NULL COMMENT '学号',
`creatwDate` datetime DEFAULT NULL COMMENT '创建时间',
`userName` varchar(20) DEFAULT NULL COMMENT '用户名',
`pad` varchar(36) DEFAULT NULL COMMENT '密码',
`phone` varchar(11) DEFAULT NULL COMMENT '手机号',
`age` tinyint(3) DEFAULT NULL COMMENT '年龄',
`sex` char(2) DEFAULT NULL COMMENT '性别',
`ineroduce` varchar(255) DEFAULT NULL COMMENT '简介'
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
2.插入语句-DML
insert into jiao values(0,'2024-02-25 10:00:00','刘德华','123456',
'12345678901',62'男','六六 六六。');
insert into jiao values(0,'2024-02-25 10:00:00','刘德华','123456',
'12345678901',62'男','六六 六六。');
insert into jiao values(0,'2024-02-25 10:00:00','刘德华','123456',
'12345678901',62'男','六六 六六。');
insert into jiao values(0,'2024-02-25 10:00:00','刘德华','123456',
'12345678901',62'男','六六 六六。');
insert into jiao values(0,'2024-02-25 10:00:00','刘德华','123456',
'12345678901',62'男','六六 六六。');
insert into jiao values(0,'2024-02-25 10:00:00','刘德华','123456',
'12345678901',62'男','六六 六六。');
3.基础查询语句-DQL
#1.基础查询
select*from jiao;
#2.分裂匿名以及筛选数据查询
select userName as'姓名',age 年龄,sex'性别',introduce '简介'
from student
where pwd is not null;
#3.去重查询
select distinct sex'性别类型'from student;
#4.排序查询
select userName as'姓名',age 年龄,sex'性别',introduce '简介' from jiao ORDER BY age desc;
select*from jiao LIMIT 2;
SELECT*FROM jiao limit 4,2;
标签:语句,COMMENT,00,jiao,六六,DML,DEFAULT,MySQL,NULL
From: https://blog.csdn.net/2302_81540284/article/details/137013124