Created
January 30, 2021 12:08
-
-
Save jdaarevalo/cc17646bcb985c551b21edf8061c685d to your computer and use it in GitHub Desktop.
second-section-fill_tables
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
... | |
-- Filling of products | |
INSERT INTO product | |
select id, concat('Product ', id) | |
FROM GENERATE_SERIES(1, current_setting('my.number_of_products')::int) as id; | |
... | |
... | |
-- Filling of cities | |
INSERT INTO city | |
select id | |
, concat('City ', id) | |
, floor(random() * (current_setting('my.number_of_coutries')::int) + 1)::int | |
FROM GENERATE_SERIES(1, current_setting('my.number_of_cities')::int) as id; | |
.... |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment