1、创建数据库
create database 数据库名字
2、删除数据库
drop database 数据库名字
3、创建表
create table 表名
4、删除表
drop table 表名
5、增加一个列
alter table 表名 add column 列名 类型
6、添加主键
alter table 表名 add primary key(列名)
7、删除主键
alter table 表名 drop primary key(列名)
几个简单的基本SQL语句
1、选择:select * from 表名 wehere 范围
2、插入:insert into 表名(字段1,字段2) values(值1,值2)
3、删除:delete from 表名 where 范围
4、更新:update 表名 set 字段=值 where 范围
5、查找:select * from 表名 where 字段 like '%要查的值%'
6、排序:select * from 表名 order by 字段1,字段2 [desc]
7、总数:select count as tatalcount from 表名
8、求和:select sun(字段) as sumvalue from 表名
9、平均:select avg(字段) as avgvalue from 表名
10、最大:select max(字段) as maxvalue from 表名
11、最小:select min(字段) as minvalue from 表名