Advertisement
Guest User

Untitled

a guest
Jun 18th, 2019
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
MySQL 4.49 KB | None | 0 0
  1. -- MySQL dump 10.17  Distrib 10.3.15-MariaDB, for Linux (x86_64)
  2. --
  3. -- Host: localhost    Database: escola
  4. -- ------------------------------------------------------
  5. -- Server version   10.3.15-MariaDB
  6.  
  7. /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
  8. /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
  9. /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
  10. /*!40101 SET NAMES utf8 */;
  11. /*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
  12. /*!40103 SET TIME_ZONE='+00:00' */;
  13. /*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
  14. /*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
  15. /*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
  16. /*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
  17.  
  18. --
  19. -- Table structure for table `alunos`
  20. --
  21. CREATE TABLE escola;
  22. USE escola;
  23.  
  24. DROP TABLE IF EXISTS `alunos`;
  25. /*!40101 SET @saved_cs_client     = @@character_set_client */;
  26. /*!40101 SET character_set_client = utf8 */;
  27. CREATE TABLE `alunos` (
  28.   `id` int(11) NOT NULL AUTO_INCREMENT,
  29.   `matricula` int(11) NOT NULL,
  30.   `telefone` int(11) NOT NULL,
  31.   `pessoa` int(11) NOT NULL,
  32.   PRIMARY KEY (`id`),
  33.   UNIQUE KEY `matricula_UNIQUE` (`matricula`),
  34.   KEY `fk_alunos_1_idx` (`pessoa`),
  35.   CONSTRAINT `fk_alunos_1` FOREIGN KEY (`pessoa`) REFERENCES `pessoas` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
  36. ) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8;
  37. /*!40101 SET character_set_client = @saved_cs_client */;
  38.  
  39. --
  40. -- Dumping data for table `alunos`
  41. --
  42.  
  43. LOCK TABLES `alunos` WRITE;
  44. /*!40000 ALTER TABLE `alunos` DISABLE KEYS */;
  45. /*!40000 ALTER TABLE `alunos` ENABLE KEYS */;
  46. UNLOCK TABLES;
  47.  
  48. --
  49. -- Table structure for table `cursos`
  50. --
  51.  
  52. DROP TABLE IF EXISTS `cursos`;
  53. /*!40101 SET @saved_cs_client     = @@character_set_client */;
  54. /*!40101 SET character_set_client = utf8 */;
  55. CREATE TABLE `cursos` (
  56.   `id` int(11) NOT NULL AUTO_INCREMENT,
  57.   `nome` varchar(60) NOT NULL,
  58.   `capacidade` int(11) DEFAULT 0,
  59.   `professor` int(11) NOT NULL,
  60.   `ativo` tinyint(4) NOT NULL,
  61.   PRIMARY KEY (`id`),
  62.   UNIQUE KEY `nome_UNIQUE` (`nome`)
  63. ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
  64. /*!40101 SET character_set_client = @saved_cs_client */;
  65.  
  66. --
  67. -- Dumping data for table `cursos`
  68. --
  69.  
  70. LOCK TABLES `cursos` WRITE;
  71. /*!40000 ALTER TABLE `cursos` DISABLE KEYS */;
  72. /*!40000 ALTER TABLE `cursos` ENABLE KEYS */;
  73. UNLOCK TABLES;
  74.  
  75. --
  76. -- Table structure for table `pessoas`
  77. --
  78.  
  79. DROP TABLE IF EXISTS `pessoas`;
  80. /*!40101 SET @saved_cs_client     = @@character_set_client */;
  81. /*!40101 SET character_set_client = utf8 */;
  82. CREATE TABLE `pessoas` (
  83.   `id` int(11) NOT NULL AUTO_INCREMENT,
  84.   `nome` varchar(120) NOT NULL,
  85.   `cpf` int(11) NOT NULL,
  86.   `sexo` varchar(10) NOT NULL,
  87.   PRIMARY KEY (`id`),
  88.   UNIQUE KEY `cpf_UNIQUE` (`cpf`)
  89. ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
  90. /*!40101 SET character_set_client = @saved_cs_client */;
  91.  
  92. --
  93. -- Dumping data for table `pessoas`
  94. --
  95.  
  96. LOCK TABLES `pessoas` WRITE;
  97. /*!40000 ALTER TABLE `pessoas` DISABLE KEYS */;
  98. /*!40000 ALTER TABLE `pessoas` ENABLE KEYS */;
  99. UNLOCK TABLES;
  100.  
  101. --
  102. -- Table structure for table `professores`
  103. --
  104.  
  105. DROP TABLE IF EXISTS `professores`;
  106. /*!40101 SET @saved_cs_client     = @@character_set_client */;
  107. /*!40101 SET character_set_client = utf8 */;
  108. CREATE TABLE `professores` (
  109.   `id` int(11) NOT NULL AUTO_INCREMENT,
  110.   `matricula` int(11) NOT NULL,
  111.   `ingresso` date NOT NULL,
  112.   `salario` float(7,2) NOT NULL,
  113.   `pessoa` int(11) NOT NULL,
  114.   PRIMARY KEY (`id`),
  115.   UNIQUE KEY `matricula_UNIQUE` (`matricula`),
  116.   KEY `fk_professores_1_idx` (`pessoa`),
  117.   CONSTRAINT `fk_professores_1` FOREIGN KEY (`pessoa`) REFERENCES `pessoas` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
  118. ) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8;
  119. /*!40101 SET character_set_client = @saved_cs_client */;
  120.  
  121. --
  122. -- Dumping data for table `professores`
  123. --
  124.  
  125. LOCK TABLES `professores` WRITE;
  126. /*!40000 ALTER TABLE `professores` DISABLE KEYS */;
  127. /*!40000 ALTER TABLE `professores` ENABLE KEYS */;
  128. UNLOCK TABLES;
  129. /*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
  130.  
  131. /*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
  132. /*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
  133. /*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
  134. /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
  135. /*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
  136. /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
  137. /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
  138.  
  139. -- Dump completed on 2019-06-18 14:51:05
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement