Reputation: 1678
I use this SQL query to insert 1 row of data:
INSERT INTO public.tasks (id, business_name, meta_title, status, title, type) VALUES (
'10'::bigint, 'business name 1'::character varying, 'meta title 1'::character varying, 'active'::character varying, 'title 1'::character varying, 'merchant'::character varying)
returning id;
Is it possible with 1 SQL query to insert 100 rows with random data into Postgre table?
Upvotes: 2
Views: 2963
Reputation: 2038
INSERT into tasks SELECT generate_series(1,100) AS id,
md5(random()::text) AS business_name,
md5(random()::text) AS meta_title,
md5(random()::text) AS status,
md5(random()::text) AS title,
md5(random()::text) AS type
Upvotes: 5