SQL Populate table with random data

前端 未结 4 1559
无人及你
无人及你 2020-12-01 05:20

I have a table with two fields:

  1. id(UUID) that is primary Key and
  2. description (var255)

I want to insert random data with SQ

4条回答
  •  旧时难觅i
    2020-12-01 05:30

    I assume sentance == statement? You could use perl or plperl as perl has some good random data generators. Check out perl CPAN module Data::Random to start.

    Here's a sample of a perl script to generate some different random stuff taken from CPAN.

    use Data::Random qw(:all);
    
      my @random_words = rand_words( size => 10 );
    
      my @random_chars = rand_chars( set => 'all', min => 5, max => 8 );
    
      my @random_set = rand_set( set => \@set, size => 5 );
    
      my $random_enum = rand_enum( set => \@set );
    
      my $random_date = rand_date();
    
      my $random_time = rand_time();
    
      my $random_datetime = rand_datetime();
    
      open(FILE, ">rand_image.png") or die $!;
      binmode(FILE);
      print FILE rand_image( bgcolor => [0, 0, 0] );
      close(FILE);
    

提交回复
热议问题