-
Notifications
You must be signed in to change notification settings - Fork 12
/
Copy pathcreatedb.sql
63 lines (55 loc) · 1.59 KB
/
createdb.sql
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
create schema if not exists startup;
use startup;
create table if not exists departments
(
id int auto_increment primary key,
name varchar(50) not null,
address varchar(50) not null,
manager_id varchar(20) not null
);
create table if not exists employees
(
pesel varchar(20) not null primary key,
last_name varchar(50) not null,
first_name varchar(50) not null,
email varchar(50) not null,
birth date not null,
phone varchar(20) not null,
home_address varchar(100) not null
);
create table if not exists employees_departments
(
employee_id varchar(20) not null,
department_id int not null,
date date not null,
primary key (employee_id, department_id)
);
create table if not exists employees_positions
(
employee_id varchar(20) not null,
position_id int not null,
date date not null,
primary key (employee_id, position_id)
);
create table if not exists managers_departments
(
employee_id varchar(20) not null,
manager_id int not null,
date date not null,
primary key (employee_id, manager_id)
);
create table if not exists positions
(
id int auto_increment
primary key,
name varchar(20) not null,
amount decimal not null,
department_id int not null
);
create table if not exists salaries
(
id int auto_increment primary key,
amount decimal not null,
date date not null,
pesel varchar(20) not null
);