下面SQL 中的;with 为什么一定要加上':with'呢,起什么作用呢.

学习 时间:2026-04-08 01:44:50 阅读:3868
下面SQL 中的;with 为什么一定要加上':with'呢,起什么作用呢.;with digits (i) as(--set up a set of numbers from 0-9select ifrom (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 characterfrom sequencewhere 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 tryingGO

最佳回答

无私的麦片

愤怒的店员

2026-04-08 01:44:50

SQL 语句里面的 with
是使用在 CTE 上面的
CTE(Common Table Expression) ,即公用表表达式,可以认为是在单个 SELECT、INSERT、UPDATE、DELETE 或 CREATE ⅥEW 语句的执行范围内定义的临时结果集。CTE 与派生表类似,具体表现在不存储为对象,并且只在查询期间有效。与派生表的不同之处在于,CTE 可自引用,还可在同一查询中引用多次。

最新回答共有2条回答

  • 健忘的往事
    回复
    2026-04-08 01:44:50

    SQL 语句里面的 with是使用在 CTE 上面的CTE(Common Table Expression) ,即公用表表达式,可以认为是在单个 SELECT、INSERT、UPDATE、DELETE 或 CREATE ⅥEW 语句的执行范围内定义的临时结果集。CTE 与派生表类似,具体表现在不存储为对象,并且只在查询期间有效。与派生表的不同之处在于,CTE 可自引用,还可在同一查询中引用多次。

上一篇 阿波罗浴缸可以装多少水

下一篇 定制衣柜门价格行情怎么样