Buscar

Atividade avaliativa

Prévia do material em texto

FACULDADE METROPOLITANA DE MANAUS
SISTEMAS DE INFORMAÇÃO
 NADIRENE MENDONÇA DE SOUZA
 BANCO DE DADOS
MANAUS/AM 209
Tipo (#id, descrição)
Departamento (#id, nome)
Zona(#id, nome)
Estado civil(#id, descrição)
Bairro(#id, nome,id_zona*)
Cliente(#cpf, nome, id_estadocivil*, id_bairro*)
Fornecedor( #cnpj, nome)
Produto( #id, preco, nome, cnpj_fornecedor*)
Itens( #id, quantidade, id_venda*,id_produto*)
Funcionário( #id, nome, login, senha, id_estadoc*, id_bairro*,id_dep*, id_tipo*)
Venda( #id , valor, data , hora , cpf_cliente*, id_funcionario*)
Create table tipo(
Id tinyint(3) primary key nor null auto_increment,
Desc varchar(20) not null );
Create table departamento(
Id tinyint(3) primary key nor null auto_increment,
nome varchar(70) not null );
create table zona(
Id tinyint(3) primary key nor null auto_increment,
nome varchar(70) not null );
create table estado(
Id tinyint(3) primary key nor null auto_increment,
Desc varchar(20) not null );
Create table bairro(
Id tinyint(3) primary key nor null auto_increment,
nome varchar(70) not null ,
id_zona tinyint (3) not null,
foreign key(id_zona) references zona(id));
create table cliente(
cpf varchar(10) ) primary key not null unique,
nome varchar(70) not null ,
id_estado tinyint(3) not null,
id_bairro tinyint(3) not null,
foreign key (id_estado) references estado(id));
foreign key (id_bairro) references bairro(id));
create table fornecedor(
cnpj varchar(14) primary key not null unique,
nome varchar(70) not null);
create table produto (
Id tinyint(3) primary key nor null auto_increment,
Preco float not null,
nome varchar(70) not null ,
cnpj_fornecedor(14) not null,
foreign key(cnpj_forncedor) references fornecedor(cnpj));
create table itens(
Id int (3) primary key nor null auto_increment,
Qtd int not null,
Id_venda tinyint(3) not null,
Id_produto tinyint(3) not null,
Foreign key(id_produto) references produto (id),
Foreign key(id_venda) references venda(id),
Create table funcionario(
Id tinyint(3) primary key nor null auto_increment,
nome varchar(70) not null,
login varchar(8) not null,
senha varchar(7) not null,
id_estado tinyint(3) not null,
id_bairro tinyint(3) not null,
id_dep tinyint(3) not null,
id_tipo tinyint(3) not null,
foreign key(id_estado) references estado(id),
foreign key(id_bairro) references bairro(id),
foreign key(id_dep) references departamento(id),
foreign key(id_tipo) references tipo(id));
create table venda(
Id tinyint(3) primary key nor null auto_increment,
Valor float not null,
Data date not null,
Hora float not null,
Id_funcionario not null,
Cpf_cliente varchar(8) not null,
Foreign key(id_funcionario) references funcionário(id),
Foreign key(cpf_cliente) references cliente(cpf));

Continue navegando