mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-23 08:02:02 +00:00
Add a test for recursive CTEs
This commit is contained in:
parent
e0f8b8d351
commit
6721ab1051
1
tests/queries/0_stateless/03274_philipzucker.reference
Normal file
1
tests/queries/0_stateless/03274_philipzucker.reference
Normal file
@ -0,0 +1 @@
|
||||
9 5 6 7 1 0 8 2
|
27
tests/queries/0_stateless/03274_philipzucker.sql
Normal file
27
tests/queries/0_stateless/03274_philipzucker.sql
Normal file
@ -0,0 +1,27 @@
|
||||
-- https://www.philipzucker.com/sql_graph_csp/
|
||||
|
||||
WITH RECURSIVE digits AS (
|
||||
SELECT 0 AS digit
|
||||
UNION ALL
|
||||
SELECT digit + 1
|
||||
FROM digits
|
||||
WHERE digit < 9
|
||||
)
|
||||
SELECT s.digit AS S, e.digit AS E, n.digit AS N, d.digit AS D,
|
||||
m.digit AS M, o.digit AS O, r.digit AS R, y.digit AS Y
|
||||
FROM digits s, digits e, digits n, digits d, digits m, digits o, digits r, digits y
|
||||
WHERE s.digit <> e.digit AND s.digit <> n.digit AND s.digit <> d.digit AND s.digit <> m.digit AND
|
||||
s.digit <> o.digit AND s.digit <> r.digit AND s.digit <> y.digit AND
|
||||
e.digit <> n.digit AND e.digit <> d.digit AND e.digit <> m.digit AND
|
||||
e.digit <> o.digit AND e.digit <> r.digit AND e.digit <> y.digit AND
|
||||
n.digit <> d.digit AND n.digit <> m.digit AND n.digit <> o.digit AND
|
||||
n.digit <> r.digit AND n.digit <> y.digit AND
|
||||
d.digit <> m.digit AND d.digit <> o.digit AND d.digit <> r.digit AND
|
||||
d.digit <> y.digit AND
|
||||
m.digit <> o.digit AND m.digit <> r.digit AND m.digit <> y.digit AND
|
||||
o.digit <> r.digit AND o.digit <> y.digit AND
|
||||
r.digit <> y.digit AND
|
||||
s.digit <> 0 AND m.digit <> 0 AND
|
||||
(1000 * s.digit + 100 * e.digit + 10 * n.digit + d.digit) +
|
||||
(1000 * m.digit + 100 * o.digit + 10 * r.digit + e.digit) =
|
||||
(10000 * m.digit + 1000 * o.digit + 100 * n.digit + 10 * e.digit + y.digit);
|
Loading…
Reference in New Issue
Block a user