-- phpMyAdmin SQL Dump
-- version 5.2.0
-- https://www.phpmyadmin.net/
--
-- Host: 127.0.0.1
-- Tempo de geração: 12-Ago-2026 às 20:15
-- Versão do servidor: 10.4.27-MariaDB
-- versão do PHP: 8.0.25

SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
START TRANSACTION;
SET time_zone = "+00:00";


/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8mb4 */;

--
-- Banco de dados: `biblioteca`
--

-- --------------------------------------------------------

--
-- Estrutura da tabela `autormiguel`
--

CREATE TABLE `autormiguel` (
  `idautormiguel` int(10) UNSIGNED NOT NULL,
  `nome` varchar(50) NOT NULL,
  `biografia` text DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Extraindo dados da tabela `autormiguel`
--

INSERT INTO `autormiguel` (`idautormiguel`, `nome`, `biografia`) VALUES
(1, 'Machado de Assis', ' nasceu pobre  no Rio de Janeiro. Autodidata e neto de pessoas negras escravizadas,  ele superou a epilepsia e a gagueira para se tornar o  maior nome da literatura brasileira, além de fundador e  primeiro presidente da Academia Brasileira de Letras.'),
(2, 'Monteiro Lobato', 'Monteiro Lobato (1882–1948) nasceu em Taubaté, São Paulo.  Foi um grande escritor, editor e pioneiro da literatura infantil no Brasil.  Ele criou o famoso universo do Sítio do Picapau Amarelo e renovou o  mercado editorial brasileiro, deixando uma marca eterna na cultura do país'),
(3, 'Agatha Christie', 'Agatha Christie (1890–1976), conhecida como a  \"Rainha do Crime\", foi uma escritora inglesa. Ela escreveu mais de 80  romances policiais e peças de teatro, criando detetives famosos como  Hercule Poirot e Miss Marple. Seus livros venderam bilhões  de cópias no mundo todo');

-- --------------------------------------------------------

--
-- Estrutura da tabela `categoriamiguel`
--

CREATE TABLE `categoriamiguel` (
  `idcategoriamiguel` int(10) UNSIGNED NOT NULL,
  `nome` varchar(50) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Extraindo dados da tabela `categoriamiguel`
--

INSERT INTO `categoriamiguel` (`idcategoriamiguel`, `nome`) VALUES
(8, 'Livro'),
(9, 'Jornal'),
(10, 'Revista'),
(11, 'DVD'),
(12, 'Folheto'),
(13, 'Cartaz do TDS');

-- --------------------------------------------------------

--
-- Estrutura da tabela `editoramiguel`
--

CREATE TABLE `editoramiguel` (
  `ideditoramiguel` int(10) UNSIGNED NOT NULL,
  `nome` varchar(50) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Extraindo dados da tabela `editoramiguel`
--

INSERT INTO `editoramiguel` (`ideditoramiguel`, `nome`) VALUES
(1, 'Editora Abril'),
(2, 'Gráfica Editorial'),
(3, 'Editora Meridional'),
(4, 'Editora Senac São Paulo'),
(5, 'Editora IFSC');

-- --------------------------------------------------------

--
-- Estrutura da tabela `generomiguel`
--

CREATE TABLE `generomiguel` (
  `idgeneromiguel` int(10) UNSIGNED NOT NULL,
  `nome` varchar(50) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Extraindo dados da tabela `generomiguel`
--

INSERT INTO `generomiguel` (`idgeneromiguel`, `nome`) VALUES
(1, 'Ação'),
(2, 'Romance'),
(3, 'Aventura'),
(4, 'Terror'),
(5, 'Comédia'),
(6, 'Ficção'),
(7, 'Esportes');

-- --------------------------------------------------------

--
-- Estrutura da tabela `localmiguel`
--

CREATE TABLE `localmiguel` (
  `idlocalmiguel` int(10) UNSIGNED NOT NULL,
  `nome` varchar(50) NOT NULL,
  `peso` double NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Extraindo dados da tabela `localmiguel`
--

INSERT INTO `localmiguel` (`idlocalmiguel`, `nome`, `peso`) VALUES
(1, 'Balcão um', 20),
(2, 'Balcão dois', 40),
(3, 'Prateleira A', 1.5),
(4, 'Prateleira B', 9.5);

-- --------------------------------------------------------

--
-- Estrutura da tabela `materialmiguel`
--

CREATE TABLE `materialmiguel` (
  `idmaterialmiguel` int(10) UNSIGNED NOT NULL,
  `editoramiguel_ideditoramiguel` int(10) UNSIGNED NOT NULL,
  `localmiguel_idlocalmiguel` int(10) UNSIGNED NOT NULL,
  `generomiguel_idgeneromiguel` int(10) UNSIGNED NOT NULL,
  `categoriamiguel_idcategoriamiguel` int(10) UNSIGNED NOT NULL,
  `titulo` varchar(255) NOT NULL,
  `paginas` int(10) UNSIGNED NOT NULL,
  `ano` year(4) NOT NULL,
  `sinopse` text NOT NULL,
  `pesopagina` double NOT NULL,
  `capa` text NOT NULL,
  `sumario` text NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

-- --------------------------------------------------------

--
-- Estrutura da tabela `mha`
--

CREATE TABLE `mha` (
  `materialmiguel_idmaterialmiguel` int(10) UNSIGNED NOT NULL,
  `autormiguel_idautormiguel` int(10) UNSIGNED NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Índices para tabelas despejadas
--

--
-- Índices para tabela `autormiguel`
--
ALTER TABLE `autormiguel`
  ADD PRIMARY KEY (`idautormiguel`);

--
-- Índices para tabela `categoriamiguel`
--
ALTER TABLE `categoriamiguel`
  ADD PRIMARY KEY (`idcategoriamiguel`);

--
-- Índices para tabela `editoramiguel`
--
ALTER TABLE `editoramiguel`
  ADD PRIMARY KEY (`ideditoramiguel`);

--
-- Índices para tabela `generomiguel`
--
ALTER TABLE `generomiguel`
  ADD PRIMARY KEY (`idgeneromiguel`);

--
-- Índices para tabela `localmiguel`
--
ALTER TABLE `localmiguel`
  ADD PRIMARY KEY (`idlocalmiguel`);

--
-- Índices para tabela `materialmiguel`
--
ALTER TABLE `materialmiguel`
  ADD PRIMARY KEY (`idmaterialmiguel`),
  ADD KEY `materialmiguel_FKIndex1` (`categoriamiguel_idcategoriamiguel`),
  ADD KEY `materialmiguel_FKIndex2` (`generomiguel_idgeneromiguel`),
  ADD KEY `materialmiguel_FKIndex3` (`localmiguel_idlocalmiguel`),
  ADD KEY `materialmiguel_FKIndex4` (`editoramiguel_ideditoramiguel`);

--
-- Índices para tabela `mha`
--
ALTER TABLE `mha`
  ADD PRIMARY KEY (`materialmiguel_idmaterialmiguel`,`autormiguel_idautormiguel`),
  ADD KEY `materialmiguel_has_autormiguel_FKIndex1` (`materialmiguel_idmaterialmiguel`),
  ADD KEY `materialmiguel_has_autormiguel_FKIndex2` (`autormiguel_idautormiguel`);

--
-- AUTO_INCREMENT de tabelas despejadas
--

--
-- AUTO_INCREMENT de tabela `autormiguel`
--
ALTER TABLE `autormiguel`
  MODIFY `idautormiguel` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=4;

--
-- AUTO_INCREMENT de tabela `categoriamiguel`
--
ALTER TABLE `categoriamiguel`
  MODIFY `idcategoriamiguel` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=14;

--
-- AUTO_INCREMENT de tabela `editoramiguel`
--
ALTER TABLE `editoramiguel`
  MODIFY `ideditoramiguel` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=6;

--
-- AUTO_INCREMENT de tabela `generomiguel`
--
ALTER TABLE `generomiguel`
  MODIFY `idgeneromiguel` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=8;

--
-- AUTO_INCREMENT de tabela `localmiguel`
--
ALTER TABLE `localmiguel`
  MODIFY `idlocalmiguel` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=5;

--
-- AUTO_INCREMENT de tabela `materialmiguel`
--
ALTER TABLE `materialmiguel`
  MODIFY `idmaterialmiguel` int(10) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- Restrições para despejos de tabelas
--

--
-- Limitadores para a tabela `materialmiguel`
--
ALTER TABLE `materialmiguel`
  ADD CONSTRAINT `materialmiguel_ibfk_1` FOREIGN KEY (`categoriamiguel_idcategoriamiguel`) REFERENCES `categoriamiguel` (`idcategoriamiguel`) ON DELETE NO ACTION ON UPDATE NO ACTION,
  ADD CONSTRAINT `materialmiguel_ibfk_2` FOREIGN KEY (`generomiguel_idgeneromiguel`) REFERENCES `generomiguel` (`idgeneromiguel`) ON DELETE NO ACTION ON UPDATE NO ACTION,
  ADD CONSTRAINT `materialmiguel_ibfk_3` FOREIGN KEY (`localmiguel_idlocalmiguel`) REFERENCES `localmiguel` (`idlocalmiguel`) ON DELETE NO ACTION ON UPDATE NO ACTION,
  ADD CONSTRAINT `materialmiguel_ibfk_4` FOREIGN KEY (`editoramiguel_ideditoramiguel`) REFERENCES `editoramiguel` (`ideditoramiguel`) ON DELETE NO ACTION ON UPDATE NO ACTION;

--
-- Limitadores para a tabela `mha`
--
ALTER TABLE `mha`
  ADD CONSTRAINT `mha_ibfk_1` FOREIGN KEY (`materialmiguel_idmaterialmiguel`) REFERENCES `materialmiguel` (`idmaterialmiguel`) ON DELETE NO ACTION ON UPDATE NO ACTION,
  ADD CONSTRAINT `mha_ibfk_2` FOREIGN KEY (`autormiguel_idautormiguel`) REFERENCES `autormiguel` (`idautormiguel`) ON DELETE NO ACTION ON UPDATE NO ACTION;
COMMIT;

/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
