Created
December 7, 2022 19:04
-
-
Save rponte/6b8f55209e29bd7b325047addbdec30a to your computer and use it in GitHub Desktop.
PostgreSQL: generating sample data
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
INSERT INTO proposal ( | |
id, address, created_at, "document", email, "name", salary, status, updated_at | |
) | |
select | |
md5(random()::text || clock_timestamp()::text)::uuid as id | |
,'Rua das Tabajaras, ' || floor(random() * 9999)::int as address | |
,localtimestamp as created_at | |
,left(md5(random()::text), 16) as "document" | |
,left(md5(random()::text), 6) || '@zup.com.br' as email | |
,'Customer ' || left(md5(random()::text), 22) as "name" | |
,trunc((random() * 99999)::numeric, 2) as salary | |
,'ELIGIBLE' as status | |
,localtimestamp as updated_at | |
from generate_series(1, 10000) s(i) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Picking random element, with weights