Skip to content

Instantly share code, notes, and snippets.

@jeffersonchaves
Last active July 29, 2024 20:00
Show Gist options
  • Save jeffersonchaves/791fe82da442e3828c8c62dca6cf59bf to your computer and use it in GitHub Desktop.
Save jeffersonchaves/791fe82da442e3828c8c62dca6cf59bf to your computer and use it in GitHub Desktop.
CREATE TABLE cidades (
id INT PRIMARY KEY,
nome VARCHAR(100),
estado VARCHAR(50)
);
CREATE TABLE atrativos (
id INT PRIMARY KEY,
nome VARCHAR(200),
tipo VARCHAR(50),
id_cidade INT,
FOREIGN KEY (id_cidade) REFERENCES cidades(id)
);
-- Inserindo dados na tabela Cidades
INSERT INTO cidades (id, nome, estado) VALUES
(1, 'Foz do Iguaçu', 'Paraná'),
(2, 'Rio de Janeiro', 'Rio de Janeiro'),
(3, 'Salvador', 'Bahia');
-- Inserindo dados na tabela Atrativos
INSERT INTO atrativos (id, nome, tipo, id_cidade) VALUES
(1, 'Cataratas do Iguaçu', 'Natural', 1),
(2, 'Usina de Itaipu', 'Tecnológico', 1),
(3, 'Cristo Redentor', 'Cultural', 2),
(4, 'Pão de Açúcar', 'Natural', 2),
(5, 'Elevador Lacerda', 'Histórico', 3),
(6, 'Pelourinho', 'Cultural', 3);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment