Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

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.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8009543
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T18:28:52+00:00 2026-06-04T18:28:52+00:00

I have to generate time values (minutes) between 5 and 30.The code should work

  • 0

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?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T18:28:54+00:00Added an answer on June 4, 2026 at 6:28 pm

    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)

    update table1 set column1 = (5+FLOOR(RAND()*26)) * 60;
    

    If you want partial minutes (in seconds)

    update table1 set column1 = (5*60)+FLOOR(RAND()*26*60);
    

    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

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

It's Friday refactor time!!! I have an object that I use to generate SQL
I am trying to generate a form at run-time. I have ended up with
I have a script that generates two lines as output each time. I'm really
I have a method that gets called any time a control on my view
I have an application that uses coldfusion's session management (instead of the J2EE) session
I have a json string that contains the values for a datetime and a
I have an app that needs to update a large amount of data over
I have a MySQL result set with 2 values in each row. Each time
I have to generate a single sql query, which retrieves two columns from two
I have to generate a single string containing all the data members of a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.