Skip to content

Instantly share code, notes, and snippets.

@samuelsonbrito
Created December 21, 2014 14:29
Show Gist options
  • Save samuelsonbrito/c28d7ad5e8f421d39c9e to your computer and use it in GitHub Desktop.
Save samuelsonbrito/c28d7ad5e8f421d39c9e to your computer and use it in GitHub Desktop.
create database locacao;
use locacao;
create table marca(
id int not null primary key auto_increment,
descricao varchar(20)
);
create table modelo(
id int not null primary key auto_increment,
descricao varchar(20)
);
create table cliente(
id int not null primary key auto_increment,
nome varchar(50),
email varchar(40),
cpf varchar(14),
fone varchar(13)
);
create table automovel(
id int not null primary key auto_increment,
ano varchar(4),
chassi varchar(17),
marca_id int,
modelo_id int,
foreign key (marca_id) references marca(id),
foreign key (modelo_id) references modelo(id)
);
create table locacao(
id int not null primary key auto_increment,
data_locacao date,
automovel_id int,
cliente_id int,
foreign key (automovel_id) references automovel(id),
foreign key (cliente_id) references cliente(id)
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment