By using db<>fiddle, you agree to license everything you submit by Creative Commons CC0.
CREATE TABLE TestTable(i INT)
INSERT INTO TestTable(i) VALUES (10);
1 rows affected
INSERT INTO TestTable(i) VALUES (20);
1 rows affected
INSERT INTO TestTable(i) VALUES (30);
1 rows affected
SELECT TestTable.*,ROW_NUMBER() OVER (ORDER BY RAND()) AS SNO
FROM TestTable;
I | SNO |
---|---|
10 | 1 |
30 | 2 |
20 | 3 |