首页 > 代码库 > sql语句分类总结

sql语句分类总结

数据定义语言DDL

create database db_name;

create table table_name (column_name data_type,...);

create view view_name as select .....;

create index on table_name (column_name,...);

drop database db_name;

drop table table_name;

drop view view_name;

drop index table_name.index_name;(不同sql方言不同,这是sql server的写法)

alter table table_name

add column_name data_type

drop column_name;

change column_name new_column_name data_type,...

modify column_name data_type,...

数据操纵语言DML

select column_name from table_name where ...

update table_name set column_name=value where ...

insert into table_name (cloumn_name,...) values (value1,...)

delete from table_name where ...

数据控制语言DCL:控制权限

grant select,updat,insert,delete on table_name to user_name@host_name;

revoke select,updat,insert,delete on table_name to user_name@host_name;

事务控制语言TCL:控制事务

commit

rollback


sql语句分类总结