Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*exercicio 1*/
- create table categorias
- (codCategoria integer auto_increment not null,
- nome varchar(45) not null,
- descricao varchar(45) not null,
- PRIMARY KEY(codCategoria));
- create table Produtos
- (codProduto integer auto_increment not null,
- codCategoria integer not null,
- nome varchar(45) not null,
- preco double(4,4) not null,
- PRIMARY KEY(codProduto),
- FOREIGN KEY (codCategoria) references categorias(codCategoria));
- create table Clientes
- (codCliente integer auto_increment not null,
- nome varchar(45) not null,
- telefone varchar(45) not null,
- limiteCredito double (4,0) not null,
- PRIMARY KEY(codCliente));
- create table Pedidos
- (numPedido integer auto_increment not null,
- codCliente integer not null,
- data date not null,
- PRIMARY KEY(numPedido),
- foreign key (codCliente) references clientes(codCliente));
- create table ProdutoPedido
- (numPedido integer not null,
- codCliente integer not null,
- dataa date not null,
- quantidade integer not null,
- PRIMARY KEY(codCliente, numPedido),
- foreign key(codCliente) references clientes(codCliente),
- foreign key(numPedido) references pedidos(codCliente));
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement