Skip to content

Instantly share code, notes, and snippets.

@anandtripathi5
Last active May 15, 2021 16:00
Show Gist options
  • Save anandtripathi5/6a5fd31bc093eefd0ac515f44515fcd0 to your computer and use it in GitHub Desktop.
Save anandtripathi5/6a5fd31bc093eefd0ac515f44515fcd0 to your computer and use it in GitHub Desktop.
Gist will create towns table and will insert 100k records in towns table using generate_series
CREATE TABLE towns (
id SERIAL UNIQUE NOT NULL,
code VARCHAR(10) NOT NULL, -- not unique
article TEXT,
name TEXT NOT NULL -- not unique
);
insert into towns (
code, article, name
)
select
left(md5(i::text), 10),
md5(random()::text),
md5(random()::text)
from generate_series(1, 100000) s(i)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment