-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathcreate_database.sql
More file actions
75 lines (63 loc) · 1.41 KB
/
create_database.sql
File metadata and controls
75 lines (63 loc) · 1.41 KB
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
64
65
66
67
68
69
70
71
72
73
74
75
--Banco de dados em postgres
create table pacientes
(
id serial
primary key,
nome varchar(100) not null,
idade integer not null,
endereco varchar(200),
telefone varchar(20)
);
alter table pacientes
owner to postgres;
create table partos
(
id serial
primary key,
data_parto date not null,
tipo_parto varchar(50) not null,
indicacao_parto varchar(100),
id_paciente integer not null
references pacientes
);
alter table partos
owner to postgres;
create table complicacoes
(
id serial
primary key,
descricao varchar(100) not null,
id_parto integer not null
references partos
);
alter table complicacoes
owner to postgres;
create table amamentacao
(
id serial
primary key,
id_parto integer not null
references partos,
inicio_amamentacao date not null,
duracao_amamentacao integer
);
alter table amamentacao
owner to postgres;
create table readmissao
(
id serial
primary key,
id_paciente integer not null
references pacientes,
data_readmissao date not null,
motivo varchar(200)
);
alter table readmissao
owner to postgres;
create table users
(
username varchar,
password varchar
);
alter table users
owner to postgres;