CREATE DATABASE IF NOT EXISTS `instituto` /*!40100 DEFAULT CHARACTER SET latin1 */;
USE `instituto`;
—
— Table structure for table `alumnos`
—
DROP TABLE IF EXISTS `alumnos`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `alumnos` (
`idalumno` int(11) NOT NULL AUTO_INCREMENT,
`expediente` varchar(45) DEFAULT NULL,
`nombre` varchar(45) DEFAULT NULL,
`apellidos` varchar(45) DEFAULT NULL,
`fecnacimiento` date DEFAULT NULL,
PRIMARY KEY (`idalumno`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;
—
— Table structure for table `mod_alu`
—
DROP TABLE IF EXISTS `mod_alu`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `mod_alu` (
`idmod_alu` int(11) NOT NULL AUTO_INCREMENT,
`idmodulo` int(11) DEFAULT NULL,
`idalumno` int(11) DEFAULT NULL,
PRIMARY KEY (`idmod_alu`),
KEY `fk_modulo_idx` (`idmodulo`),
KEY `fk_alumno_idx` (`idalumno`),
CONSTRAINT `fk_alumno` FOREIGN KEY (`idalumno`) REFERENCES `alumnos` (`idalumno`) ON UPDATE CASCADE,
CONSTRAINT `fk_modulo` FOREIGN KEY (`idmodulo`) REFERENCES `modulos` (`idmodulo`) ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;
—
— Table structure for table `modulos`
—
DROP TABLE IF EXISTS `modulos`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `modulos` (
`idmodulo` int(11) NOT NULL AUTO_INCREMENT,
`idprofesor` int(11) DEFAULT NULL,
`codigo` varchar(45) DEFAULT NULL,
`nombre` varchar(45) DEFAULT NULL,
PRIMARY KEY (`idmodulo`),
KEY `fk_profesor_idx` (`idprofesor`),
CONSTRAINT `fk_profesor` FOREIGN KEY (`idprofesor`) REFERENCES `profesores` (`idprofesor`) ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;
—
— Table structure for table `profesores`
—
DROP TABLE IF EXISTS `profesores`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `profesores` (
`idprofesor` int(11) NOT NULL AUTO_INCREMENT,
`dni` varchar(45) DEFAULT NULL,
`nombre` varchar(45) DEFAULT NULL,
`direccion` varchar(45) DEFAULT NULL,
`telefono` varchar(45) DEFAULT NULL,
PRIMARY KEY (`idprofesor`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;