下面SQL 中的;with 为什么一定要加上':with'呢,起什么作用呢.
;with
digits (i) as(--set up a set of numbers from 0-9
select i
from (VALUES (0),(1),(2),(3),(4),(5),(6),(7),(8),(9)) as digits (i))
--builds a table from 0 to 99999
,sequence (i) as (
SELECT D1.i + (10*D2.i) + (100*D3.i) + (1000*D4.i) + (10000*D5.i)
FROM digits AS D1 CROSS JOIN digits AS D2 CROSS JOIN digits AS D3
CROSS JOIN digits AS D4 CROSS JOIN digits AS D5)
select i,nchar(i) as character
from sequence
where i between 48 and 122 --vary to include any characters
--in the character set of choice
order by nchar(i) collate Latin1_General_bin --change to the collation you
--are trying
GO
人气:206 ℃ 时间:2020-06-02 11:28:01
解答
SQL 语句里面的 with是使用在 CTE 上面的CTE(Common Table Expression) ,即公用表表达式,可以认为是在单个 SELECT、INSERT、UPDATE、DELETE 或 CREATE ⅥEW 语句的执行范围内定义的临时结果集.CTE 与派生表类似,具体...
推荐
- SQL 中with的用法
- 英语翻译(英译汉)
- 在RLC串联电路中,已知I=1A,UR=15V,UL=80V,UC=60V.求电路的总电压?
- ( )you please give me a piece of advice?
- 设(G,*)是可交换群,a,b属于G,a和b都是2阶元素,证明(G,*)必有4阶子群
- 怎样有效地提高新GRE填空分数
- 求DNA连接酶和DNA聚合酶的异同
- 已知等腰三角形底边长420cm,两底角45度,求两条腰有多长
猜你喜欢
- concern一个简单英语题目
- 孔子说他三十而立,四十不惑,五十知天命,六十而耳顺,七十从心所欲,
- x减百分之二十五x等于21
- 英语翻译
- 动物的生命现象
- 作文 那一次我哭了急 !
- 一艘小船,最初在南岸,从南岸向北岸行驶,再从北岸驶回南岸,不断往返. ( 1 )这艘小船摆渡的次数为.
- 读了这篇短文,你有什么感受?(胜利的故事 80字)