Sample Header Ad - 728x90

Is there a way to insert multiple rows into a table with default values for all columns?

17 votes
2 answers
19314 views
I can insert multiple rows into a table with default values for all columns the [RBAR](https://www.simple-talk.com/sql/t-sql-programming/rbar--row-by-agonizing-row/) way: create table course(course_id serial primary key); do $$ begin for i in 1..100000 loop insert into course default values; end loop; end;$$; Is there a way of doing the same with a single SQL statement?
Asked by Jack Douglas (40537 rep)
Jan 17, 2015, 02:35 PM
Last activity: Oct 8, 2022, 11:11 AM