-
Notifications
You must be signed in to change notification settings - Fork 0
/
db.sql
58 lines (50 loc) · 1.04 KB
/
db.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
CREATE DATABASE jorgescarros;
USE jorgescarros;
CREATE TABLE carro (
codigo int(6) auto_increment primary key,
placa char(7),
renavam char(9),
status int(2),
categoria int(2),
tipo_motor int(2),
cor int(2),
modelo varchar(30),
ano int,
marca varchar(20),
km_litro float(2,2),
volume_tanque int,
ar_condicionado int(1),
gps int(1),
direcao_automatica int(1),
radio_bluetooth int(1)
);
CREATE TABLE entrada (
codigo int(6) auto_increment primary key,
motivo varchar(15),
horario TIMESTAMP
);
CREATE TABLE saida (
codigo int(6) auto_increment primary key,
motivo varchar(15),
horario TIMESTAMP
);
/*PACOTE CLIENTE*/
create table endereco (
codendereco int auto_increment primary key,
cep varchar(7),
cidade varchar(20),
estado varchar(2),
bairro varchar(20),
numero int,
complemento varchar(20),
logradouro varchar(20)
);
create table cliente (
cpf varchar(11) primary key,
rg varchar(9),
nome varchar(20),
cnh varchar(11),
datanasc DATE,
codendereco int,
FOREIGN KEY(codendereco) REFERENCES endereco(codendereco)
);