SQL命令大全-中英文对照第1/3页

sql命令大全-中英文对照

–语 句 功 能

–数据操作

select –从数据库表中检索数据行和列

insert –向数据库表添加新数据行

delete –从数据库表中删除数据行

update –更新数据库表中的数据

–数据定义

create table –创建一个数据库表

drop table –从数据库中删除表

alter table –修改数据库表结构

create view –创建一个视图

drop view –从数据库中删除视图

create index –为数据库表创建一个索引

drop index –从数据库中删除索引

create procedure –创建一个存储过程

drop procedure –从数据库中删除存储过程

create trigger –创建一个触发器

drop trigger –从数据库中删除触发器

create schema –向数据库添加一个新模式

drop schema –从数据库中删除一个模式

create domain –创建一个数据值域

alter domain –改变域定义

drop domain –从数据库中删除一个域

–数据控制

grant –授予用户访问权限

deny –拒绝用户访问

revoke –解除用户访问权限

–事务控制

commit –结束当前事务

rollback –中止当前事务

set transaction –定义当前事务数据访问特征

–程序化sql

declare –为查询设定游标

explan –为查询描述数据访问计划

open –检索查询结果打开一个游标

fetch –检索一行查询结果

close –关闭游标

prepare –为动态执行准备sql 语句

execute –动态地执行sql 语句

describe –描述准备好的查询 

—局部变量

declare @id char(10)

–set @id = ‘10010001’

select @id = ‘10010001’ 

—全局变量

—必须以@@开头

–if else

declare @x int @y int @z int

select @x = 1 @y = 2 @z=3

if @x > @y

print ‘x > y’ –打印字符串’x > y’

else if @y > @z

print ‘y > z’

else print ‘z > y’

–case

use pangu

update employee

set e_wage =

case

when job_level = ‘1’ then e_wage*1.08

when job_level = ‘2’ then e_wage*1.07

when job_level = ‘3’ then e_wage*1.06

else e_wage*1.05

end

–while continue break

declare @x int @y int @c int

select @x = 1 @y=1

while @x < 3

begin

print @x –打印变量x 的值

while @y < 3

begin

select @c = 100*@x + @y

print @c –打印变量c 的值

select @y = @y + 1

end

select @x = @x + 1

select @y = 1

end

–waitfor

–例 等待1 小时2 分零3 秒后才执行select 语句

waitfor delay ’01:02:03′

select * from employee

–例 等到晚上11 点零8 分后才执行select 语句

waitfor time ’23:08:00′

select * from employee


1

(0)
上一篇 2022年3月21日
下一篇 2022年3月21日

相关推荐