How to insert into mysql table random number 0 or 1

How to insert into mysql table random number 0 or 1

For test purpose I needed to populate a table field with random int number 0 and 1.

The RAND() function from mysql return numbers between 0 and 1 but 0.1, 0.5435 etc are float not int so with the next query you can generate random number between 0 and 1 .Watch movie online A Cure for Wellness (2017)


SELECT ROUND(RAND());

/* and if you want to make an insert with this function */
UPDATE `my_table` set flag = ROUND(RAND());

No comments.