· 7 years ago · Oct 26, 2018, 12:36 PM
1DROP DATABASE IF EXISTS loja; /*melhor comando*/
2/*sidawn é gai*/
3/*1)Crie o Banco de Dados LOJA, as tabelas e inclua os registros abaixo:*/
4/*sidawn é gai*/
5CREATE DATABASE IF NOT EXISTS loja;
6USE loja;
7/*sidawn é gai*/
8CREATE TABLE IF NOT EXISTS clientes(
9id integer auto_increment not null primary key,
10nome varchar(50) not null,
11endereco varchar(80),
12id_cidade integer);
13/*sidawn é gai*/
14CREATE TABLE IF NOT EXISTS cidades(
15id integer auto_increment not null primary key,
16nome varchar(60) not null,
17uf varchar(2));
18/*sidawn é gai*/
19CREATE TABLE IF NOT EXISTS produtos(
20id integer auto_increment not null primary key,
21descricao varchar(100) not null,
22codigo_barra integer,
23id_categoria integer,
24id_fornecedor integer);
25/*sidawn é gai*/
26CREATE TABLE IF NOT EXISTS categorias(
27id integer auto_increment not null primary key,
28descricao varchar(60) not null);
29
30/*sidawn é gai*/
31
32CREATE TABLE IF NOT EXISTS fornecedores(
33id integer auto_increment not null primary key,
34razao_social varchar(80) not null,
35id_cidade integer);
36
37/*sidawn é gai*/