Last active
March 23, 2020 16:31
-
-
Save takaram/11fa8320bf6bc682abbaa7a42680f775 to your computer and use it in GitHub Desktop.
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
CREATE TABLE employees ( | |
id serial primary key, -- ID | |
name text, -- 名前 | |
join_year integer, -- 入社年 | |
department_id integer -- 所属部署ID | |
); | |
CREATE TABLE departments ( | |
id serial primary key, -- ID | |
name text -- 部署名 | |
); | |
INSERT INTO departments (name) | |
SELECT format('営業%s課', i) FROM generate_series(1, 500) i; | |
INSERT INTO departments (name) | |
SELECT format('開発%s課', i) FROM generate_series(1, 500) i; | |
INSERT INTO employees (name, join_year, department_id) | |
SELECT format('社員%s', i), 2000 + (random() * 20)::integer, i % 1000 + 1 FROM generate_series(1, 50000) i; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment