1

In SQL in Postgres, how do I create and insert n number of rows of test data with random strings length x?

e.g.,

CREATE TABLE my_table (my_text_column TEXT);
-- now insert n rows of test data into my_table, with random
-- strings of length x for my_text_column
Rob Bednark
  • 25,981
  • 23
  • 80
  • 125

1 Answers1

4

The answer is already available here

create table yourtable as select descr from 
          (SELECT generate_series(1,10) AS id,md5(random()::text) AS descr)s;
Community
  • 1
  • 1
cableload
  • 4,215
  • 5
  • 36
  • 62