This seems to work for me using PSQL v11.30.
create table chartest (f1 char (10), f2 char(10), f3 char(10));
insert into chartest values ('a','a','a');
insert into chartest values ('b','b','b');
insert into chartest values ('c','c','c');
insert into chartest values ('d','d','d');
insert into chartest values ('e','e','e');
insert into chartest values ('f','f','f');
select top 1 * from chartest order by newid()
Which I ran several times and got:
<<<<<<<<<<<<<<<<<<<<<<<<
f1 f2 f3
========== ========== ==========
e e e
1 row was affected.
>>>>>>>>>>>>>>>>>>>>>>>>
<<<<<<<<<<<<<<<<<<<<<<<<
f1 f2 f3
========== ========== ==========
c c c
1 row was affected.
>>>>>>>>>>>>>>>>>>>>>>>>
<<<<<<<<<<<<<<<<<<<<<<<<
f1 f2 f3
========== ========== ==========
b b b
1 row was affected.
>>>>>>>>>>>>>>>>>>>>>>>>
<<<<<<<<<<<<<<<<<<<<<<<<
f1 f2 f3
========== ========== ==========
f f f
1 row was affected.
>>>>>>>>>>>>>>>>>>>>>>>>
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.