-- MySQL dump 10.13  Distrib 5.7.20, for Linux (x86_64)
--
-- Host: localhost    Database: AbOut_Test
-- ------------------------------------------------------
-- Server version	5.7.20

/*!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 */;

--
-- Table structure for table `AssessOutcome`
--

DROP TABLE IF EXISTS `AssessOutcome`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `AssessOutcome` (
  `assessId` int(11) NOT NULL,
  `oAbbrev` char(6) NOT NULL,
  PRIMARY KEY (`assessId`,`oAbbrev`),
  KEY `assessment_idx` (`assessId`),
  KEY `outcome_idx` (`oAbbrev`),
  CONSTRAINT `assessOutAssessment` FOREIGN KEY (`assessId`) REFERENCES `Assessment` (`assessId`) ON UPDATE CASCADE,
  CONSTRAINT `assessOutOutcome` FOREIGN KEY (`oAbbrev`) REFERENCES `Outcome` (`oAbbrev`) ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Table structure for table `Assessment`
--

DROP TABLE IF EXISTS `Assessment`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `Assessment` (
  `assessId` int(11) NOT NULL AUTO_INCREMENT,
  `offeringId` int(11) NOT NULL,
  `description` varchar(200) DEFAULT NULL,
  `maxPoints` int(11) NOT NULL DEFAULT '100',
  PRIMARY KEY (`assessId`),
  UNIQUE KEY `unique_fields` (`offeringId`,`description`,`maxPoints`) USING BTREE,
  KEY `offering_idx` (`offeringId`),
  CONSTRAINT `offering` FOREIGN KEY (`offeringId`) REFERENCES `Offering` (`offeringId`) ON UPDATE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=1275 DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Table structure for table `Course`
--

DROP TABLE IF EXISTS `Course`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `Course` (
  `cAbbrev` char(10) NOT NULL,
  `cName` varchar(80) NOT NULL,
  `csFlag` tinyint(1) DEFAULT '0',
  `seFlag` tinyint(1) DEFAULT NULL,
  `beginSem` int(11) NOT NULL,
  `endSem` int(11) DEFAULT NULL,
  PRIMARY KEY (`cAbbrev`),
  KEY `beginSemester_idx` (`beginSem`),
  KEY `endSemester_idx` (`endSem`),
  CONSTRAINT `courseBeginSemester` FOREIGN KEY (`beginSem`) REFERENCES `Semester` (`semesterId`) ON UPDATE CASCADE,
  CONSTRAINT `courseEndSemester` FOREIGN KEY (`endSem`) REFERENCES `Semester` (`semesterId`) ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Table structure for table `CourseOutcome`
--

DROP TABLE IF EXISTS `CourseOutcome`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `CourseOutcome` (
  `cAbbrev` char(10) NOT NULL,
  `oAbbrev` char(6) NOT NULL,
  PRIMARY KEY (`cAbbrev`,`oAbbrev`),
  KEY `course_idx` (`cAbbrev`),
  KEY `outcome_idx` (`oAbbrev`),
  CONSTRAINT `course` FOREIGN KEY (`cAbbrev`) REFERENCES `Course` (`cAbbrev`) ON UPDATE CASCADE,
  CONSTRAINT `outcome` FOREIGN KEY (`oAbbrev`) REFERENCES `Outcome` (`oAbbrev`) ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Table structure for table `CoursePrefix`
--

DROP TABLE IF EXISTS `CoursePrefix`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `CoursePrefix` (
  `cPrefix` char(6) NOT NULL,
  PRIMARY KEY (`cPrefix`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Table structure for table `DefaultSemester`
--

DROP TABLE IF EXISTS `DefaultSemester`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `DefaultSemester` (
  `semesterId` int(11) NOT NULL,
  PRIMARY KEY (`semesterId`),
  CONSTRAINT `semester` FOREIGN KEY (`semesterId`) REFERENCES `Semester` (`semesterId`) ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Table structure for table `OffOutcome`
--

DROP TABLE IF EXISTS `OffOutcome`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `OffOutcome` (
  `offeringId` int(11) NOT NULL,
  `oAbbrev` char(6) NOT NULL,
  PRIMARY KEY (`offeringId`,`oAbbrev`),
  KEY `offering_idx` (`offeringId`),
  KEY `outcome_idx` (`oAbbrev`),
  CONSTRAINT `offOutOffering` FOREIGN KEY (`offeringId`) REFERENCES `Offering` (`offeringId`) ON UPDATE CASCADE,
  CONSTRAINT `offOutOutcome` FOREIGN KEY (`oAbbrev`) REFERENCES `Outcome` (`oAbbrev`) ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Table structure for table `Offering`
--

DROP TABLE IF EXISTS `Offering`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `Offering` (
  `offeringId` int(11) NOT NULL AUTO_INCREMENT,
  `cAbbrev` char(10) NOT NULL,
  `semesterId` int(11) NOT NULL,
  `sectionNo` char(2) NOT NULL DEFAULT '01',
  `userId` int(11) DEFAULT NULL,
  `fName` varchar(50) NOT NULL,
  PRIMARY KEY (`offeringId`),
  KEY `user_idx` (`userId`),
  KEY `course_idx` (`cAbbrev`),
  KEY `semester_idx` (`semesterId`),
  CONSTRAINT `offeringCourse` FOREIGN KEY (`cAbbrev`) REFERENCES `Course` (`cAbbrev`) ON UPDATE CASCADE,
  CONSTRAINT `offeringSemester` FOREIGN KEY (`semesterId`) REFERENCES `Semester` (`semesterId`) ON UPDATE CASCADE,
  CONSTRAINT `offeringUser` FOREIGN KEY (`userId`) REFERENCES `User` (`userId`) ON DELETE SET NULL ON UPDATE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=253 DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Table structure for table `Outcome`
--

DROP TABLE IF EXISTS `Outcome`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `Outcome` (
  `oAbbrev` char(6) NOT NULL,
  `oText` varchar(500) DEFAULT NULL,
  `pAbbrev` char(10) NOT NULL,
  `beginSem` int(11) NOT NULL,
  `endSem` int(11) DEFAULT NULL,
  PRIMARY KEY (`oAbbrev`),
  KEY `beginSemester_idx` (`beginSem`),
  KEY `endSemester_idx` (`endSem`),
  KEY `program_idx` (`pAbbrev`),
  CONSTRAINT `beginSemester` FOREIGN KEY (`beginSem`) REFERENCES `Semester` (`semesterId`) ON UPDATE CASCADE,
  CONSTRAINT `endSemester` FOREIGN KEY (`endSem`) REFERENCES `Semester` (`semesterId`) ON UPDATE CASCADE,
  CONSTRAINT `program` FOREIGN KEY (`pAbbrev`) REFERENCES `Program` (`pAbbrev`) ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Table structure for table `OutcomePrefix`
--

DROP TABLE IF EXISTS `OutcomePrefix`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `OutcomePrefix` (
  `oPrefix` char(3) NOT NULL,
  PRIMARY KEY (`oPrefix`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Table structure for table `Prefix`
--

DROP TABLE IF EXISTS `Prefix`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `Prefix` (
  `prefix` char(6) NOT NULL,
  PRIMARY KEY (`prefix`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Table structure for table `Program`
--

DROP TABLE IF EXISTS `Program`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `Program` (
  `pAbbrev` char(10) NOT NULL,
  PRIMARY KEY (`pAbbrev`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Table structure for table `Score`
--

DROP TABLE IF EXISTS `Score`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `Score` (
  `assessId` int(11) NOT NULL,
  `studentId` int(11) NOT NULL,
  `score` decimal(8,2) DEFAULT NULL,
  PRIMARY KEY (`assessId`,`studentId`),
  KEY `student_idx` (`studentId`),
  CONSTRAINT `scoreAssessment` FOREIGN KEY (`assessId`) REFERENCES `Assessment` (`assessId`) ON UPDATE CASCADE,
  CONSTRAINT `scoreStudent` FOREIGN KEY (`studentId`) REFERENCES `Student` (`studentId`) ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Table structure for table `Semester`
--

DROP TABLE IF EXISTS `Semester`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `Semester` (
  `semesterId` int(11) NOT NULL AUTO_INCREMENT,
  `semester` char(12) NOT NULL,
  PRIMARY KEY (`semesterId`),
  UNIQUE KEY `semester_UNIQUE` (`semester`)
) ENGINE=InnoDB AUTO_INCREMENT=23 DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- 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` (
  `studentId` int(11) NOT NULL AUTO_INCREMENT,
  `sName` char(50) NOT NULL,
  `offeringId` int(11) NOT NULL,
  PRIMARY KEY (`studentId`),
  KEY `offering_idx` (`offeringId`),
  CONSTRAINT `studentOffering` FOREIGN KEY (`offeringId`) REFERENCES `Offering` (`offeringId`) ON UPDATE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=2555 DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Table structure for table `User`
--

DROP TABLE IF EXISTS `User`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `User` (
  `userId` int(11) NOT NULL AUTO_INCREMENT,
  `usernameCAS` varchar(50) NOT NULL,
  `uName` varchar(50) NOT NULL,
  `activeFlag` tinyint(1) DEFAULT NULL,
  PRIMARY KEY (`userId`),
  UNIQUE KEY `usernameCAS_UNIQUE` (`usernameCAS`),
  UNIQUE KEY `uName_UNIQUE` (`uName`)
) ENGINE=InnoDB AUTO_INCREMENT=46 DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;

/*!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 2018-02-26 16:18:16
