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 7713759
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T01:57:14+00:00 2026-06-01T01:57:14+00:00

Im new to MySql, and I need to insert into table 10000 random 2-digit

  • 0

Im new to MySql, and I need to insert into table 10000 random 2-digit numbers. Is there Easy way to to this?

  • 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-01T01:57:15+00:00Added an answer on June 1, 2026 at 1:57 am

    Try this:

    DELIMITER $$
    CREATE PROCEDURE random_fill( IN cnt INT )
    BEGIN
    
        fold: LOOP
    
             IF cnt < 1 THEN
                 LEAVE fold;
             END IF;
    
            INSERT INTO foo ( bar ) VALUES ( 9 + CEIL( RAND() * 90 ) );
    
            SET cnt = cnt - 1;
        END LOOP fold;
    
    END$$   
    DELIMIMTER ;
    

    To use this:

    CALL random_fill(10000);
    

    What you have to change is this line:

    INSERT INTO foo ( bar ) VALUES ( CEIL( RAND() * higher ) );
    

    Replace the foo and bar with something that exists in your database. It is possible to create a procedure, where the name of table and row are also supplied as parameters, but that would require to CONCAT the query on fly .. looks hack’ish and ugly.

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

Sidebar

Related Questions

I am fairly new to MySQL and have a project in which I need
Can we create a new MySQL database( not a table, I want a new
[...] public DataSet ReturnPromoMagazinesDs() { MySql.Data.MySqlClient.MySqlConnection mysqlConnection = new MySql.Data.MySqlClient.MySqlConnection(this.connectionString); MySql.Data.MySqlClient.MySqlCommand mysqlCommand = new
I am new to MySql database. I've large table(ID,...). I select ID frequently with
I am very, very new to MYSQL.I tried to create a table named option.
I have a MySQL insert statement that inserts data from an existing Despgoods table
Supposing I am inserting a row into a table in MySql by php code,
Following this article , I've been able to partly transpose a mySQL table. This
I am very new to mysql and php. I need to put an array
I have MySQL table that doesn't have AUTO_INCREMENT field. In PHP I run this

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.