Skip to content

Commit 44ecf41

Browse files
committed
Solutions to SQL Alternative Queries section
1 parent 5fb64c3 commit 44ecf41

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
WITH THOUSAND AS
2+
(SELECT *
3+
FROM
4+
(SELECT LEVEL LVL
5+
FROM DUAL CONNECT BY LEVEL <= 1000)
6+
WHERE LVL > 1)
7+
SELECT LISTAGG(T1.LVL, '&') WITHIN GROUP(ORDER BY T1.LVL)
8+
FROM THOUSAND T1
9+
WHERE T1.LVL <=
10+
(SELECT COUNT(DISTINCT T2.LVL) + 2
11+
FROM THOUSAND T2
12+
WHERE T2.LVL < T1.LVL
13+
AND MOD(T1.LVL, T2.LVL) > 0);

0 commit comments

Comments
 (0)