I want to create a new column based on an existing column plus some uniform random numbers.
Data
-- borrowed from https://stackoverflow.com/q/7745609/808921
CREATE TABLE IF NOT EXISTS `docs` (
`id` int(6) unsigned NOT NULL,
`rev` int(3) unsigned NOT NULL,
`content` float unsigned NOT NULL,
PRIMARY KEY (`id`,`rev`)
) DEFAULT CHARSET=utf8;
INSERT INTO `docs` (`id`, `rev`, `content`) VALUES
('1', '1', '1.24546'),
('2', '1', '1.245546546'),
('1', '2', '1.25654546'),
('1', '3', '1.2421323546');
Based on the OracleSQL documentation here, I tried:
SELECT id, rev, content,
content + DBMS_RANDOM.VALUE AS content2
FROM docs
There obviously is no "expected output" here, given the randomness, but I hope the schema + code are sufficiently clear to demonstrate what I am trying to achieve