Last active
February 18, 2020 13:28
-
-
Save aykononov/2745b8b9e8aecf3c667a2d9af16349c8 to your computer and use it in GitHub Desktop.
Вывести 1000 случайных чисел от 1 до 1000, таких, что не повторяются в этой последовательности, больше чем 3 раза.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT t2.rnum | |
FROM (SELECT t.rnum, | |
RANK() OVER(PARTITION BY t.rnum ORDER BY(1)) rnk | |
FROM ( SELECT trunc(dbms_random.value(1, 1000)) AS rnum | |
FROM dual | |
CONNECT BY LEVEL <= 1000) t | |
) t2 | |
WHERE t2.rnk < 4; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment