-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathScript-2.sql
More file actions
37 lines (30 loc) · 759 Bytes
/
Copy pathScript-2.sql
File metadata and controls
37 lines (30 loc) · 759 Bytes
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
--create database letscode_plano_de_saude;
--cliente: nome, data de nascimento, email
create table cliente (
id int primary key,
nome varchar(100) not null,
data_nascimento date not null,
email varchar(50) not null
)
create table dependentes (
id int primary key,
cliente_id int references cliente(id),
nome varchar(100) not null,
data_nascimento date not null
)
create table produto (
id int primary key,
ans int not null,
descricao varchar(100) not null,
valor numeric not null
)
create table contrato (
id int primary key,
cliente_id int references cliente(id),
data_inicio date not null
)
create table produto_contrato (
id int primary key,
contrato_id int references contrato(id),
produto_id int references produto(id)
)