Skip to content

Instantly share code, notes, and snippets.

@cristofersousa
Created October 8, 2024 08:51
Show Gist options
  • Select an option

  • Save cristofersousa/636c17793f5ebd615b5ade383b0d3dad to your computer and use it in GitHub Desktop.

Select an option

Save cristofersousa/636c17793f5ebd615b5ade383b0d3dad to your computer and use it in GitHub Desktop.
create database petshopDB;
use petshopDB;
CREATE TABLE Clientes (
id_cliente INT AUTO_INCREMENT PRIMARY KEY,
nome VARCHAR(100) NOT NULL,
telefone VARCHAR(20),
email VARCHAR(100)
);
CREATE TABLE Pets (
id_pet INT AUTO_INCREMENT PRIMARY KEY,
nome VARCHAR(50) NOT NULL,
tipo VARCHAR(30), -- Ex: Cachorro, Gato, etc.
raca VARCHAR(50),
data_nascimento DATE,
id_cliente INT, -- Chave estrangeira que liga Pets a Clientes
FOREIGN KEY (id_cliente) REFERENCES Clientes(id_cliente)
);
CREATE TABLE Consultas (
id_consulta INT AUTO_INCREMENT PRIMARY KEY,
data_consulta DATE NOT NULL,
descricao TEXT,
id_pet INT, -- Chave estrangeira que liga Consultas a Pets
FOREIGN KEY (id_pet) REFERENCES Pets(id_pet)
);
CREATE TABLE Produtos (
id_produto INT AUTO_INCREMENT PRIMARY KEY,
nome_produto VARCHAR(100) NOT NULL,
descricao TEXT,
preco DECIMAL(10, 2)
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment