1.创建数据库
create database database_name;
2.查看数据库
show databases;
3.切换数据库
use database database_name;
4.查数据库中的表
show tables;
5.创建表
create table table_name([column_name] [column_type], [column_name] [column_type]);
6.删除表
drop table table_name
7.表 添加字段
alter table table_name add column column_name column_type;
8.删除表内容
delete from table_name ;
9.插入表内容
insert into table_name values(' ', ' ', ' ');
10.更新字段的值
update table_name set column_name=' ' where column_name='';
11.聚合语句
聚合函数 max(), min(), sum(), avg()
having 以聚合函数为条件过滤
分组 group by 排序 order by
select count(*) from table_name; 获取所有的记录条数
select sum(column) from table_name group by column_name; 获取每个组的某个字段的和
select max(column_name) from table_name group by column_name; 获取分组中每个组的某个字段的值最大的那条记录
select max(column_name) from table_name group by column_name having max(column_name) > number; # 过滤最大值