Code: Select all
truncate table ColorsRand;
insert into ColorsRand select subquery.colour from (select random() + randomint(100), colour from Colors order by 1) as subquery limit 3;
select * from Colors left outer join ColorsRand on Colors.colour = ColorsRand.colour;
Code: Select all
TRUNCATE TABLE
OUTPUT
--------
3
(1 row)
colour | colour
---------+---------
#DCDCDC | #DCDCDC
#FFCCBB |
Black |
Blue |
Green |
Magenta | Magenta
Orange |
White |
Yellow | Yellow
(9 rows)