定食屋DDL_従業員管理_20211113
定食屋D
https://gyazo.com/e910130d9d8f8667b926ce17210ae6c0
mysql
code:restaurant_ddl.sql
create database restaurant;
use restaurant;
create table emp_pos (
no integer(2) primary key,
name varchar(10)
);
create table emp (
no integer(4) primary key,
name varchar(10),
hiredate date,
sal integer(7),
quitdate date,
posno integer(2)
);
postgres
code:restaurant_ddl.sql
create database restaurant;
\c restaurant;
create table emp_pos (
no integer primary key,
name varchar(10)
);
create table emp (
no integer primary key,
name varchar(10),
hiredate date,
sal integer,
quitdate date,
posno integer
);
code:restaurant_init.sql
insert into emp_pos(no, name) values(1, '店長');
insert into emp_pos(no, name) values(2, '社員');
insert into emp_pos(no, name) values(3, 'パート');
insert into emp_pos(no, name) values(4, 'アルバイト');
insert into emp(no, name, hiredate, sal, quitdate, posno) values(1001, '田中太郎', '2010-4-1', 300000, null, 1);
insert into emp(no, name, hiredate, sal, quitdate, posno) values(2002, '佐藤一郎', '2010-4-1', 250000, null, 2);
insert into emp(no, name, hiredate, sal, quitdate, posno) values(2003, '鈴木花子', '2017-10-1', 230000, null, 2);
insert into emp(no, name, hiredate, sal, quitdate, posno) values(2004, '高橋洋子', '2017-10-1', 230000, '2020-3-31', 2);
insert into emp(no, name, hiredate, sal, quitdate, posno) values(3001, '中村瞳', '2010-4-1', 100000, '2016-10-31', 3);
insert into emp(no, name, hiredate, sal, quitdate, posno) values(3002, '加藤さくら', '2010-4-1', 150000, null, 3);
insert into emp(no, name, hiredate, sal, quitdate, posno) values(3003, '渡辺二郎', '2014-4-1', 150000, null, 3);
insert into emp(no, name, hiredate, sal, quitdate, posno) values(3004, '山口葵', '2016-4-1', 120000, null, 3);
insert into emp(no, name, hiredate, sal, quitdate, posno) values(4001, '林三郎', '2015-4-1', 80000, '2018-3-1', 4);
insert into emp(no, name, hiredate, sal, quitdate, posno) values(4002, '山田史郎', '2016-4-1', 60000, null, 4);
insert into emp(no, name, hiredate, sal, quitdate, posno) values(4003, '斎藤吾郎', '2017-4-1', 65000, null, 4);
insert into emp(no, name, hiredate, sal, quitdate, posno) values(4004, '山本晴彦', '2018-4-1', 55000, null, 4);
insert into emp(no, name, hiredate, sal, quitdate, posno) values(4005, '松本綾', '2018-6-1', 77000, null, 4);
insert into emp(no, name, hiredate, sal, quitdate, posno) values(4006, '吉田舞', '2020-4-1', 40000, null, 4);
中身の出力
code:console
mysql> select * from emp;
+------+------------+------------+--------+------------+-------+
| no | name | hiredate | sal | quitdate | posno |
+------+------------+------------+--------+------------+-------+
| 1001 | 田中太郎 | 2010-04-01 | 300000 | NULL | 1 |
| 2002 | 佐藤一郎 | 2010-04-01 | 250000 | NULL | 2 |
| 2003 | 鈴木花子 | 2017-10-01 | 230000 | NULL | 2 |
| 2004 | 高橋洋子 | 2017-10-01 | 230000 | 2020-03-31 | 2 |
| 3001 | 中村瞳 | 2010-04-01 | 100000 | 2016-10-31 | 3 |
| 3002 | 加藤さくら | 2010-04-01 | 150000 | NULL | 3 |
| 3003 | 渡辺二郎 | 2014-04-01 | 150000 | NULL | 3 |
| 3004 | 山口葵 | 2016-04-01 | 120000 | NULL | 3 |
| 4001 | 林三郎 | 2015-04-01 | 80000 | 2018-03-01 | 4 |
| 4002 | 山田史郎 | 2016-04-01 | 60000 | NULL | 4 |
| 4003 | 斎藤吾郎 | 2017-04-01 | 65000 | NULL | 4 |
| 4004 | 山本晴彦 | 2018-04-01 | 55000 | NULL | 4 |
| 4005 | 松本綾 | 2018-06-01 | 77000 | NULL | 4 |
| 4006 | 吉田舞 | 2020-04-01 | 40000 | NULL | 4 |
+------+------------+------------+--------+------------+-------+
14 rows in set (0.00 sec)
mysql> select * from emp_pos;
+----+------------+
| no | name |
+----+------------+
| 1 | 店長 |
| 2 | 社員 |
| 3 | パート |
| 4 | アルバイト |
+----+------------+
4 rows in set (0.00 sec)
2022/1/8
高橋洋子さんのデータが入っていなくて修正した。