Requisitos

Las herramientas de software para realizar el ejemplo son los siguientes:

Base de datos

 
  
    
    CREATE SCHEMA `transportdb` DEFAULT CHARACTER SET utf8 ;
    
  CREATE TABLE `transportdb`.`licencia` (
  `idlicencia` VARCHAR(30) NOT NULL,
  `nombre` VARCHAR(200) NOT NULL,
  `apellidoPaterno` VARCHAR(200) NOT NULL,
  `apellidoMaterno` VARCHAR(200)  NULL,
  `fechaObtencion` DATE NOT NULL,
  `fechaExpiracion` DATE NOT NULL,
  `tipoLetra` VARCHAR(5) NOT NULL,
  PRIMARY KEY (`idlicencia`))
ENGINE = MyISAM
DEFAULT CHARACTER SET = utf8;



CREATE TABLE `transportdb`.`transporte` (
  `idTransporte` INT NOT NULL AUTO_INCREMENT,
  `matricula` VARCHAR(20) NOT NULL,
  `marca` VARCHAR(150) NOT NULL,
  `modelo` VARCHAR(300) NOT NULL,
  `carga` VARCHAR(45) NOT NULL,
  `tipoLicencia` VARCHAR(10) NOT NULL,
  `disponibilidad` VARCHAR(45) NOT NULL,
  PRIMARY KEY (`idTransporte`))
ENGINE = MyISAM
DEFAULT CHARACTER SET = utf8;
   
 CREATE TABLE `transportdb`.`transportista` (
  `idTransportista` INT NOT NULL AUTO_INCREMENT,
  `idTransporte` INT NOT NULL,
  `idlicencia` VARCHAR(30) NOT NULL,
  `nombre` VARCHAR(200) NOT NULL,
  `apellidoPaterno` VARCHAR(200) NOT NULL,
  `apellidoMaterno` VARCHAR(200) NULL,
  `telefono` VARCHAR(20) NOT NULL,
  PRIMARY KEY (`idTransportista`))
ENGINE = MyISAM
DEFAULT CHARACTER SET = utf8; 


CREATE TABLE `transportdb`.`viajes` (
  `idViaje` INT NOT NULL AUTO_INCREMENT,
  `fecha` DATE NOT NULL,
  `idTransporte` INT NOT NULL,
  `idTransportista` INT NOT NULL,
  `nombre` VARCHAR(200) NOT NULL,
  `apellidoPaterno` VARCHAR(200) NOT NULL,
  `apellidoMaterno` VARCHAR(200) NULL,
  `descripcion` VARCHAR(5000) NOT NULL,
  PRIMARY KEY (`idViaje`))
ENGINE = MyISAM
DEFAULT CHARACTER SET = utf8;