提交 aafd35c1 authored 作者: Philippe Marschall's avatar Philippe Marschall

Document recursive common table expressions

H2 supports recursive common table expressions. Unfortunately they are
not covered in the official grammar documentation so some people don't
know about it.

I had to reverse engineer the syntax by looking at the parser source so
it may contain errors. This commit does contain maybe not the greatest
documentation ever but I feel it's an improvement over the current
situation.
上级 6287f318
......@@ -192,6 +192,24 @@ Lists the schemas, tables, or the columns of a table.
SHOW TABLES
"
"Commands (DML)","WITH","
WITH [ RECURSIVE ] name ( columnName [,...] )
AS ( select )
select
","
Can be used to create a recursive query. The first select has to be a UNION.
Currently only one result set can be referred to by name.
","
WITH RECURSIVE t(n) AS (
SELECT 1
UNION ALL
SELECT n + 1
FROM t
WHERE n < 100
)
SELECT sum(n) FROM t;
"
"Commands (DDL)","ALTER INDEX RENAME","
ALTER INDEX [ IF EXISTS ] indexName RENAME TO newIndexName
","
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论