Advertisement
Guest User

Untitled

a guest
Mar 18th, 2017
179
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.73 KB | None | 0 0
  1. -- --------------------------------------------------------
  2. -- Host: 127.0.0.1
  3. -- Server version: 10.1.21-MariaDB - mariadb.org binary distribution
  4. -- Server OS: Win32
  5. -- HeidiSQL Version: 9.4.0.5125
  6. -- --------------------------------------------------------
  7.  
  8. /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
  9. /*!40101 SET NAMES utf8 */;
  10. /*!50503 SET NAMES utf8mb4 */;
  11. /*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
  12. /*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
  13.  
  14.  
  15. -- Dumping database structure for db_stackoverflow
  16. CREATE DATABASE IF NOT EXISTS `db_stackoverflow` /*!40100 DEFAULT CHARACTER SET latin1 */;
  17. USE `db_stackoverflow`;
  18.  
  19. -- Dumping structure for table db_stackoverflow.t_classes
  20. CREATE TABLE IF NOT EXISTS `t_classes` (
  21. `class_ID` int(10) unsigned NOT NULL AUTO_INCREMENT,
  22. PRIMARY KEY (`class_ID`)
  23. ) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=latin1;
  24.  
  25. -- Dumping data for table db_stackoverflow.t_classes: ~2 rows (approximately)
  26. DELETE FROM `t_classes`;
  27. /*!40000 ALTER TABLE `t_classes` DISABLE KEYS */;
  28. INSERT INTO `t_classes` (`class_ID`) VALUES
  29. (1),
  30. (2);
  31. /*!40000 ALTER TABLE `t_classes` ENABLE KEYS */;
  32.  
  33. -- Dumping structure for table db_stackoverflow.t_exams
  34. CREATE TABLE IF NOT EXISTS `t_exams` (
  35. `exam_ID` int(10) unsigned NOT NULL AUTO_INCREMENT,
  36. `class_ID` int(10) unsigned DEFAULT NULL,
  37. PRIMARY KEY (`exam_ID`),
  38. KEY `FK_t_exams_t_classes` (`class_ID`),
  39. CONSTRAINT `FK_t_exams_t_classes` FOREIGN KEY (`class_ID`) REFERENCES `t_classes` (`class_ID`)
  40. ) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=latin1;
  41.  
  42. -- Dumping data for table db_stackoverflow.t_exams: ~0 rows (approximately)
  43. DELETE FROM `t_exams`;
  44. /*!40000 ALTER TABLE `t_exams` DISABLE KEYS */;
  45. INSERT INTO `t_exams` (`exam_ID`, `class_ID`) VALUES
  46. (1, 1),
  47. (2, 2),
  48. (3, 2);
  49. /*!40000 ALTER TABLE `t_exams` ENABLE KEYS */;
  50.  
  51. -- Dumping structure for table db_stackoverflow.t_grades
  52. CREATE TABLE IF NOT EXISTS `t_grades` (
  53. `exam_ID` int(10) unsigned DEFAULT NULL,
  54. `student_ID` int(10) unsigned DEFAULT NULL,
  55. `grade` int(10) unsigned DEFAULT NULL,
  56. KEY `FK__t_exams` (`exam_ID`),
  57. KEY `FK__t_students` (`student_ID`),
  58. CONSTRAINT `FK__t_exams` FOREIGN KEY (`exam_ID`) REFERENCES `t_exams` (`exam_ID`),
  59. CONSTRAINT `FK__t_students` FOREIGN KEY (`student_ID`) REFERENCES `t_students` (`student_ID`)
  60. ) ENGINE=InnoDB DEFAULT CHARSET=latin1;
  61.  
  62. -- Dumping data for table db_stackoverflow.t_grades: ~0 rows (approximately)
  63. DELETE FROM `t_grades`;
  64. /*!40000 ALTER TABLE `t_grades` DISABLE KEYS */;
  65. INSERT INTO `t_grades` (`exam_ID`, `student_ID`, `grade`) VALUES
  66. (1, 4, 6);
  67. /*!40000 ALTER TABLE `t_grades` ENABLE KEYS */;
  68.  
  69. -- Dumping structure for table db_stackoverflow.t_students
  70. CREATE TABLE IF NOT EXISTS `t_students` (
  71. `student_ID` int(10) unsigned NOT NULL AUTO_INCREMENT,
  72. `class_ID` int(10) unsigned NOT NULL DEFAULT '0',
  73. PRIMARY KEY (`student_ID`),
  74. KEY `FK_t_students_t_classes` (`class_ID`),
  75. CONSTRAINT `FK_t_students_t_classes` FOREIGN KEY (`class_ID`) REFERENCES `t_classes` (`class_ID`)
  76. ) ENGINE=InnoDB AUTO_INCREMENT=10 DEFAULT CHARSET=latin1;
  77.  
  78. -- Dumping data for table db_stackoverflow.t_students: ~0 rows (approximately)
  79. DELETE FROM `t_students`;
  80. /*!40000 ALTER TABLE `t_students` DISABLE KEYS */;
  81. INSERT INTO `t_students` (`student_ID`, `class_ID`) VALUES
  82. (4, 1),
  83. (6, 1),
  84. (5, 2);
  85. /*!40000 ALTER TABLE `t_students` ENABLE KEYS */;
  86.  
  87. /*!40101 SET SQL_MODE=IFNULL(@OLD_SQL_MODE, '') */;
  88. /*!40014 SET FOREIGN_KEY_CHECKS=IF(@OLD_FOREIGN_KEY_CHECKS IS NULL, 1, @OLD_FOREIGN_KEY_CHECKS) */;
  89. /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement