I have to generate time values (minutes) between 5 and 30.The code should work and generate 5-30 minutes but instead of that I get 5-30 seconds:
update table1
set column1 = 5+FLOOR(RAND()*26);column1 is a TIME column
Any suggestions?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
If you are just storing a number of seconds or minutes then you are not storing a ‘time’ so column1 should not be a time type…
If you want whole minutes (in seconds)
If you want partial minutes (in seconds)
If you just want a whole number of minutes (5 to 30) then your original query should be fine once you change the column type to int