1

I want to create a table 'content' with the column name 'info' with each line inserted with the text "Record number 1" up to "Record number 100".

I've created the table and column so far with this code but I'm not sure how to generate the range:

CREATE TABLE content (info TEXT);

1 Answer 1

4
  • This can be done using generate_series in following way.

      create table content (info text); 
    
      insert into content
      select concat('Record number ', generate_series(1, 100));  
    
      select * from content; 
    
  • Here's DB Fiddle

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.