Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- --------------------------------------------------------
- -- Host: 127.0.0.1
- -- Server version: 10.1.21-MariaDB - mariadb.org binary distribution
- -- Server OS: Win32
- -- HeidiSQL Version: 9.4.0.5125
- -- --------------------------------------------------------
- /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
- /*!40101 SET NAMES utf8 */;
- /*!50503 SET NAMES utf8mb4 */;
- /*!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' */;
- -- Dumping database structure for db_stackoverflow
- CREATE DATABASE IF NOT EXISTS `db_stackoverflow` /*!40100 DEFAULT CHARACTER SET latin1 */;
- USE `db_stackoverflow`;
- -- Dumping structure for table db_stackoverflow.t_classes
- CREATE TABLE IF NOT EXISTS `t_classes` (
- `class_ID` int(10) unsigned NOT NULL AUTO_INCREMENT,
- PRIMARY KEY (`class_ID`)
- ) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=latin1;
- -- Dumping data for table db_stackoverflow.t_classes: ~2 rows (approximately)
- DELETE FROM `t_classes`;
- /*!40000 ALTER TABLE `t_classes` DISABLE KEYS */;
- INSERT INTO `t_classes` (`class_ID`) VALUES
- (1),
- (2);
- /*!40000 ALTER TABLE `t_classes` ENABLE KEYS */;
- -- Dumping structure for table db_stackoverflow.t_exams
- CREATE TABLE IF NOT EXISTS `t_exams` (
- `exam_ID` int(10) unsigned NOT NULL AUTO_INCREMENT,
- `class_ID` int(10) unsigned DEFAULT NULL,
- PRIMARY KEY (`exam_ID`),
- KEY `FK_t_exams_t_classes` (`class_ID`),
- CONSTRAINT `FK_t_exams_t_classes` FOREIGN KEY (`class_ID`) REFERENCES `t_classes` (`class_ID`)
- ) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=latin1;
- -- Dumping data for table db_stackoverflow.t_exams: ~0 rows (approximately)
- DELETE FROM `t_exams`;
- /*!40000 ALTER TABLE `t_exams` DISABLE KEYS */;
- INSERT INTO `t_exams` (`exam_ID`, `class_ID`) VALUES
- (1, 1),
- (2, 2),
- (3, 2);
- /*!40000 ALTER TABLE `t_exams` ENABLE KEYS */;
- -- Dumping structure for table db_stackoverflow.t_grades
- CREATE TABLE IF NOT EXISTS `t_grades` (
- `exam_ID` int(10) unsigned DEFAULT NULL,
- `student_ID` int(10) unsigned DEFAULT NULL,
- `grade` int(10) unsigned DEFAULT NULL,
- KEY `FK__t_exams` (`exam_ID`),
- KEY `FK__t_students` (`student_ID`),
- CONSTRAINT `FK__t_exams` FOREIGN KEY (`exam_ID`) REFERENCES `t_exams` (`exam_ID`),
- CONSTRAINT `FK__t_students` FOREIGN KEY (`student_ID`) REFERENCES `t_students` (`student_ID`)
- ) ENGINE=InnoDB DEFAULT CHARSET=latin1;
- -- Dumping data for table db_stackoverflow.t_grades: ~0 rows (approximately)
- DELETE FROM `t_grades`;
- /*!40000 ALTER TABLE `t_grades` DISABLE KEYS */;
- INSERT INTO `t_grades` (`exam_ID`, `student_ID`, `grade`) VALUES
- (1, 4, 6);
- /*!40000 ALTER TABLE `t_grades` ENABLE KEYS */;
- -- Dumping structure for table db_stackoverflow.t_students
- CREATE TABLE IF NOT EXISTS `t_students` (
- `student_ID` int(10) unsigned NOT NULL AUTO_INCREMENT,
- `class_ID` int(10) unsigned NOT NULL DEFAULT '0',
- PRIMARY KEY (`student_ID`),
- KEY `FK_t_students_t_classes` (`class_ID`),
- CONSTRAINT `FK_t_students_t_classes` FOREIGN KEY (`class_ID`) REFERENCES `t_classes` (`class_ID`)
- ) ENGINE=InnoDB AUTO_INCREMENT=10 DEFAULT CHARSET=latin1;
- -- Dumping data for table db_stackoverflow.t_students: ~0 rows (approximately)
- DELETE FROM `t_students`;
- /*!40000 ALTER TABLE `t_students` DISABLE KEYS */;
- INSERT INTO `t_students` (`student_ID`, `class_ID`) VALUES
- (4, 1),
- (6, 1),
- (5, 2);
- /*!40000 ALTER TABLE `t_students` ENABLE KEYS */;
- /*!40101 SET SQL_MODE=IFNULL(@OLD_SQL_MODE, '') */;
- /*!40014 SET FOREIGN_KEY_CHECKS=IF(@OLD_FOREIGN_KEY_CHECKS IS NULL, 1, @OLD_FOREIGN_KEY_CHECKS) */;
- /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement