库的操作展示所有数据库--show databases--创建数据库--create database test001--数据库基本信息字符集编码排序规则--character set(默认utf8mb4)--collation--修改数据库--alter database test001 charset tf8mb4--删除数据库--drop database ...--使用数据库--use ...--常用的数据类型--int--bigint----double--decimal( , )----varchar()--text----datetime--表的操作选定数据库--use test001--创建表--create table student (field列名 datatype数据类型 comment对列的描述或说明 )mysql create table users ( id bigint, name varchar(20) comment ⽤⼾名, password char(32) comment 密码是32位的md5值, birthday date comment ⽣⽇ ) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci;查看表结构--desc student--修改表--alter table ... add password char(32) after ...--ADD向表中添加列 MODIFY修改表中现有的列 DROP删除表中现有的列RENAMECOLUMN重命名表中现有的列 RENAME[TO|AS]new_tbl_name重命名当前的表展示所有表--show tables--删除表--drop table ...--CRUDCreate 新增在表中插入数据insert into student values (1孙悟空)2孙行者)指定了具体要插⼊的列-- insert into users(id, name) values (3, 王五 );--Retrieve 检索查询字段--select * from students----select id,name from students----select id10,name from students--去除重复记录--select distinct name from students;--条件查询--select id,name from students where id10;-- 先执行where筛选符合条件记录再执行select ....筛选条件列--and or 的优先级--select * from exam where chinese 80 or math 70 and english 70;--先执行math 70 and english 70后chinese 80--使⽤ BETWEEN AND 实现 mysql select name, chinese from exam where chinese between 80 and 90; # 使⽤AND 实现 mysql select name, chinese from exam where chinese 80 and chinese 90;模糊查询--select id,name from students where name like 孙 %;--%代表一个或无数个 任意字符 _代表一个任意字符--