-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbdTccUltimate.txt
More file actions
65 lines (59 loc) · 1.99 KB
/
bdTccUltimate.txt
File metadata and controls
65 lines (59 loc) · 1.99 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
create database tcc
use tcc
create table Contratante(
cod_contratante int primary key identity (1,1) not null,
nome_contratante varchar(50) not null,
cnpj_contratante char(20) not null,
email_contratante varchar(50) not null,
telefone_contratante char(15) not null,
data_contratacao date not null
)
create table Funcionario(
cod_funcionario int primary key identity(1,1) not null,
cargo varchar(20) not null,
nome_funcionario varchar(50) not null,
dtnasc_funcionario date not null,
cnh_funcionario varchar (11) not null,
tel_funcionario char (15) not null,
cpf_funcionario char (15) not null
)
create table Veiculo(
placa_veiculo varchar(10) primary key not null,
tipo_veiculo varchar(10) not null,
modelo_veiculo varchar(40) not null,
ano_veiculo numeric(4) not null,
seguro_veiculo varchar(15) not null
)
create table Manutencao(
cod_manutencao int primary key identity(1,1) not null,
placa_veiculo varchar(10) FOREIGN KEY REFERENCES Veiculo(placa_veiculo) on delete cascade,
data_manutencao date not null,
manutencao_preventiva varchar(20) not null,
status_manutencao varchar(20) not null,
)
create table Viagem(
cod_viagem int primary key identity(1,1) not null,
destino_viagem varchar(200) not null,
reg_saida date not null,
reg_entrada date not null,
status_viagem varchar(20) not null,
placa_veiculo varchar(10) FOREIGN KEY REFERENCES Veiculo(placa_veiculo),
cod_contratante int FOREIGN KEY REFERENCES Contratante(cod_contratante) ON DELETE cascade,
cod_funcionario int FOREIGN KEY REFERENCES Funcionario(cod_funcionario)ON DELETE cascade
)
create table Gastos(
cod_gastos int not null primary key identity (1,1),
gasolina float not null,
pedagio float,
data_multa date,
valor_multa float,
manutencao_corretiva float,
cod_funcionario int FOREIGN KEY REFERENCES Funcionario(cod_funcionario),
cod_viagem int FOREIGN KEY REFERENCES Viagem(cod_viagem) ON DELETE cascade
)
create table Usuario(
cod_usuario int not null PRIMARY KEY identity(1,1),
usuario varchar(50) not null,
senha varchar(12) not null
)
delete cascade em UM