Last active
September 10, 2024 13:29
-
-
Save bastienapp/862a60ce56d0347352106e826faccb42 to your computer and use it in GitHub Desktop.
SQL Part 2
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- MySQL dump 10.13 Distrib 5.7.19, for Linux (x86_64) | |
-- | |
-- Host: localhost Database: bastien_k2_wcs_toulouse | |
-- ------------------------------------------------------ | |
-- Server version 5.7.19-0ubuntu0.16.04.1 | |
/*!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 utf8 */; | |
/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */; | |
/*!40103 SET TIME_ZONE='+00:00' */; | |
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; | |
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; | |
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; | |
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; | |
-- | |
-- Current Database: `bastien_k2_wcs_toulouse` | |
-- | |
CREATE DATABASE /*!32312 IF NOT EXISTS*/ `bastien_k2_wcs_toulouse` /*!40100 DEFAULT CHARACTER SET latin1 */; | |
USE `bastien_k2_wcs_toulouse`; | |
-- | |
-- Table structure for table `classroom` | |
-- | |
DROP TABLE IF EXISTS `classroom`; | |
/*!40101 SET @saved_cs_client = @@character_set_client */; | |
/*!40101 SET character_set_client = utf8 */; | |
CREATE TABLE `classroom` ( | |
`classroom_id` int(11) NOT NULL AUTO_INCREMENT, | |
`name` varchar(25) NOT NULL, | |
`school_id` int(11) NOT NULL, | |
PRIMARY KEY (`classroom_id`), | |
KEY `FK_classroom_school_id` (`school_id`), | |
CONSTRAINT `FK_classroom_school_id` FOREIGN KEY (`school_id`) REFERENCES `school` (`school_id`) | |
) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=latin1; | |
/*!40101 SET character_set_client = @saved_cs_client */; | |
-- | |
-- Dumping data for table `classroom` | |
-- | |
LOCK TABLES `classroom` WRITE; | |
/*!40000 ALTER TABLE `classroom` DISABLE KEYS */; | |
INSERT INTO `classroom` VALUES (1,'Salle de dojo',1),(2,'Salle de réunion',1),(3,'Salle de repos',1),(4,'Cuisine',1),(5,'Bureau',1),(6,'OpenSpace',1); | |
/*!40000 ALTER TABLE `classroom` ENABLE KEYS */; | |
UNLOCK TABLES; | |
-- | |
-- Table structure for table `instructor` | |
-- | |
DROP TABLE IF EXISTS `instructor`; | |
/*!40101 SET @saved_cs_client = @@character_set_client */; | |
/*!40101 SET character_set_client = utf8 */; | |
CREATE TABLE `instructor` ( | |
`instructor_id` int(11) NOT NULL AUTO_INCREMENT, | |
`person_id` int(11) NOT NULL, | |
`language_id` int(11) NOT NULL, | |
PRIMARY KEY (`instructor_id`,`person_id`), | |
KEY `FK_instructor_person_id` (`person_id`), | |
KEY `FK_instructor_language_id` (`language_id`), | |
CONSTRAINT `FK_instructor_language_id` FOREIGN KEY (`language_id`) REFERENCES `language` (`language_id`), | |
CONSTRAINT `FK_instructor_person_id` FOREIGN KEY (`person_id`) REFERENCES `person` (`person_id`) | |
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=latin1; | |
/*!40101 SET character_set_client = @saved_cs_client */; | |
-- | |
-- Dumping data for table `instructor` | |
-- | |
LOCK TABLES `instructor` WRITE; | |
/*!40000 ALTER TABLE `instructor` DISABLE KEYS */; | |
INSERT INTO `instructor` VALUES (1,1,1); | |
/*!40000 ALTER TABLE `instructor` ENABLE KEYS */; | |
UNLOCK TABLES; | |
-- | |
-- Table structure for table `language` | |
-- | |
DROP TABLE IF EXISTS `language`; | |
/*!40101 SET @saved_cs_client = @@character_set_client */; | |
/*!40101 SET character_set_client = utf8 */; | |
CREATE TABLE `language` ( | |
`language_id` int(11) NOT NULL AUTO_INCREMENT, | |
`name` varchar(25) NOT NULL, | |
PRIMARY KEY (`language_id`) | |
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=latin1; | |
/*!40101 SET character_set_client = @saved_cs_client */; | |
-- | |
-- Dumping data for table `language` | |
-- | |
LOCK TABLES `language` WRITE; | |
/*!40000 ALTER TABLE `language` DISABLE KEYS */; | |
INSERT INTO `language` VALUES (1,'Android'); | |
/*!40000 ALTER TABLE `language` ENABLE KEYS */; | |
UNLOCK TABLES; | |
-- | |
-- Table structure for table `person` | |
-- | |
DROP TABLE IF EXISTS `person`; | |
/*!40101 SET @saved_cs_client = @@character_set_client */; | |
/*!40101 SET character_set_client = utf8 */; | |
CREATE TABLE `person` ( | |
`person_id` int(11) NOT NULL AUTO_INCREMENT, | |
`firstname` varchar(25) NOT NULL, | |
`lastname` varchar(25) NOT NULL, | |
PRIMARY KEY (`person_id`) | |
) ENGINE=InnoDB AUTO_INCREMENT=12 DEFAULT CHARSET=latin1; | |
/*!40101 SET character_set_client = @saved_cs_client */; | |
-- | |
-- Dumping data for table `person` | |
-- | |
LOCK TABLES `person` WRITE; | |
/*!40000 ALTER TABLE `person` DISABLE KEYS */; | |
INSERT INTO `person` VALUES (1,'Bastien','K'),(2,'Eric','Cartman'),(3,'Bart','Simpson'),(4,'Okay','Google'),(5,'Lorie','Pester'),(6,'Marty','McFly'),(7,'Frodon','Sacquet'),(8,'John Fitzgerald','Kennedy'),(9,'Luke','Skywalker'),(10,'Henry Walton Junior','Jones'),(11,'Rocky','Balboa'); | |
/*!40000 ALTER TABLE `person` ENABLE KEYS */; | |
UNLOCK TABLES; | |
-- | |
-- Table structure for table `reservation` | |
-- | |
DROP TABLE IF EXISTS `reservation`; | |
/*!40101 SET @saved_cs_client = @@character_set_client */; | |
/*!40101 SET character_set_client = utf8 */; | |
CREATE TABLE `reservation` ( | |
`datetime` date NOT NULL, | |
`duration` int(11) NOT NULL, | |
`person_id` int(11) NOT NULL, | |
`classroom_id` int(11) NOT NULL, | |
PRIMARY KEY (`person_id`,`classroom_id`), | |
KEY `FK_reservation_classroom_id` (`classroom_id`), | |
CONSTRAINT `FK_reservation_classroom_id` FOREIGN KEY (`classroom_id`) REFERENCES `classroom` (`classroom_id`), | |
CONSTRAINT `FK_reservation_person_id` FOREIGN KEY (`person_id`) REFERENCES `person` (`person_id`) | |
) ENGINE=InnoDB DEFAULT CHARSET=latin1; | |
/*!40101 SET character_set_client = @saved_cs_client */; | |
-- | |
-- Dumping data for table `reservation` | |
-- | |
LOCK TABLES `reservation` WRITE; | |
/*!40000 ALTER TABLE `reservation` DISABLE KEYS */; | |
INSERT INTO `reservation` VALUES ('2017-09-25',60,2,1),('2017-09-25',60,3,1),('2017-09-25',60,4,1),('2017-09-25',180,5,5),('2017-09-25',180,6,5),('2017-09-25',120,7,3),('2017-09-25',240,8,6),('2017-09-25',240,9,6),('2017-09-25',240,10,6),('2017-09-25',240,11,6); | |
/*!40000 ALTER TABLE `reservation` ENABLE KEYS */; | |
UNLOCK TABLES; | |
-- | |
-- Table structure for table `school` | |
-- | |
DROP TABLE IF EXISTS `school`; | |
/*!40101 SET @saved_cs_client = @@character_set_client */; | |
/*!40101 SET character_set_client = utf8 */; | |
CREATE TABLE `school` ( | |
`school_id` int(11) NOT NULL AUTO_INCREMENT, | |
`name` varchar(25) NOT NULL, | |
PRIMARY KEY (`school_id`) | |
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=latin1; | |
/*!40101 SET character_set_client = @saved_cs_client */; | |
-- | |
-- Dumping data for table `school` | |
-- | |
LOCK TABLES `school` WRITE; | |
/*!40000 ALTER TABLE `school` DISABLE KEYS */; | |
INSERT INTO `school` VALUES (1,'WCS Toulouse'); | |
/*!40000 ALTER TABLE `school` ENABLE KEYS */; | |
UNLOCK TABLES; | |
-- | |
-- Table structure for table `student` | |
-- | |
DROP TABLE IF EXISTS `student`; | |
/*!40101 SET @saved_cs_client = @@character_set_client */; | |
/*!40101 SET character_set_client = utf8 */; | |
CREATE TABLE `student` ( | |
`student_id` int(11) NOT NULL AUTO_INCREMENT, | |
`address` text NOT NULL, | |
`person_id` int(11) NOT NULL, | |
PRIMARY KEY (`student_id`,`person_id`), | |
KEY `FK_student_person_id` (`person_id`), | |
CONSTRAINT `FK_student_person_id` FOREIGN KEY (`person_id`) REFERENCES `person` (`person_id`) | |
) ENGINE=InnoDB AUTO_INCREMENT=22 DEFAULT CHARSET=latin1; | |
/*!40101 SET character_set_client = @saved_cs_client */; | |
-- | |
-- Dumping data for table `student` | |
-- | |
LOCK TABLES `student` WRITE; | |
/*!40000 ALTER TABLE `student` DISABLE KEYS */; | |
INSERT INTO `student` VALUES (10,'South Park',2),(11,'Springfield',3),(12,'Here',4),(13,'Le Plessis-Bouchard',5),(14,'Back to the Future',6),(17,'Cul-de-Sac',7),(18,'Arlington',8),(19,'In a galaxy, far, far away',9),(20,'Bedford',10),(21,'Philadelphia',11); | |
/*!40000 ALTER TABLE `student` ENABLE KEYS */; | |
UNLOCK TABLES; | |
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; | |
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */; | |
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; | |
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */; | |
/*!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 */; | |
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; | |
-- Dump completed on 2017-09-25 18:28:23 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment