I am going to write a trigger which inserts a row into a table. The insert statement includes an ID
column. I want my trigger to randomly choose one out of three IDs to insert, is it possible?
You can use the RAND
function to generate a random number such that i <= x < j
.
FLOOR(i + RAND() * (j – i))
Here you can find the documentation on the RAND
function.
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.