Criar Tabelas:- Criar tabela tabela_teste de itens com 7 campos:
- ID[Primary key]
- item[varchar]
- precodevenda[float]
- loja[$loja.nome]
- categoria[$produto.categoria]
- subcategoria[$produto.subcategoria]
- datadecompra[$produto.datacompra];
>create database teste;
>use teste;
>create table loja (
id int not null primary key AUTO_INCREMENT,
nome varchar(255) not null,
endereco varchar(255) not null,
cep int not null,
)
engine=innodb default charset = utf8;
>create table produto (
id int not null primary key AUTO_INCREMENT,
nome varchar(255) not null,
categoria int not null,
subcategoria int not null,
datacompra date not null
)
engine=innodb default charset = utf8;
>create table tabela_teste (
id int not null primary key AUTO_INCREMENT,
item varchar(255) not null,
precovenda varchar(255),
fk_loja int not null,
fk_categoria int not null,
fk_subcategoria int not null,
fk_datadecompra int not null
)
engine=innodb default charset = utf8;