T-SQL基本语句使用,select语法、insert语法、update语法、delete语法

select语法

select [all|distinct] [ top (<表达式>) [percent] [with ties] ] <列名列表>
[from <源表/视图>]
[where <限制条件>]
[group by <列名称或表达式使用选择列表中的列>]
[having <基于组的结果限制性条件>]
[order by <列名列表>]
[ [for xml [raw|auto|explicit|path [(<元素>)]] [,xmldata][,elements][,binary base 64]]
[option (<查询提示>,[, ...n])]

insert语法

insert [top ( <expression> ) [percent] ] [into] <tabular object>
[ (<column list>) ]
[ output <output clause> ]
[ values (<data values>) [, (<data values>) ] [, ...n]
| <table source>
|exec <prodecure>

update语法

update [top ( <expression> ) [perecnt] ]<tabular object>
set <column>=<value> [. write (<expression>,<offset>,<length>)]
[,<column>=<value>[.write(expression>,<offset>,<length>)]
[output <output clause> ]
[from <source table(s)>]

delete语法

delete [top ( <expression> ) [precent] ] [from] <tabular object>
[output <output clause> ]
[from <table or join condition>]
[where <search condition> | current of [global] <cursor name>]
(0)
上一篇 2022年3月21日
下一篇 2022年3月21日

相关推荐