码迷,mamicode.com
首页 > 数据库 > 详细

sql语句分类总结

时间:2017-02-17 00:32:01      阅读:205      评论:0      收藏:0      [点我收藏+]

标签: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语句分类总结

标签:sql

原文地址:http://8365613.blog.51cto.com/8355613/1898617

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!