dml语句
1.插入记录insert into tablename (fielde1..2...3) values (value1..2...3);2.更新记录update table set fied1=value1 [where condition]3.删除记录delete from tablename [where]4.查询记录select * from tablename [where]select count(*) from tablename 查看多少条数据(1)不重复查询select distinct * from tablename;(2)条件查询select * from tablename where 字段[<,>,=,<=,>=,!= | or , and ](3)排序和限制desc 降序asc 升序select * from tablename [where ] order by 字段 desc|asc(4)子查询innot in=!=existsnot existsselect * from tablename where 字段 = (select * from tablename)(5)记录联合union 去除重复在合并union all 结果直接合并
ddl语句
1.创建数据库create database databasename;2.查看有哪些库show databases;3.进入数据库use databasesname;4.创建表create table tablename (字段名 类型());5.查看有哪些表show tables;6.查看表结构desc tablename;7.删除数据库drop database dbname;8.删除表drop table tablename;9.修改表结构alter table tablename modify 字段名 修改的值10.增加表字段alter table tablename add column 字段名 type;11.删除字段alter table tablename drop column 字段名;12字段名alter table tablename change oldtablename newtablename ;13.更改表名alter table tablename rename new_tablename;14.修改字段排序alter table tablename modfiy
dcl语句
grant * on databasename.tablename to username@% identified by 'pass'例如:grant all privileges on *.* to 178common@'%' identified by 'common';grant select,insert,update,delete on *.* to 224test@'%' identified by '224test';