UcanDB
1244 palavras
5 páginas
SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0;SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0;
SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='TRADITIONAL';
DROP SCHEMA IF EXISTS `ucanDB` ;
CREATE SCHEMA IF NOT EXISTS `ucanDB` DEFAULT CHARACTER SET latin1 COLLATE latin1_swedish_ci ;
USE `ucanDB` ;
-- -----------------------------------------------------
-- Table `ucanDB`.`Pais`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `ucanDB`.`Pais` ( `idPais` INT NOT NULL AUTO_INCREMENT , `nomePais` VARCHAR(45) NULL , PRIMARY KEY (`idPais`) )
ENGINE = InnoDB;
-- -----------------------------------------------------
-- Table `ucanDB`.`Provincia`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `ucanDB`.`Provincia` ( `idProvincia` INT NOT NULL AUTO_INCREMENT , `nomeProvin` VARCHAR(45) NULL , `Pais_idPais` INT NOT NULL , PRIMARY KEY (`idProvincia`, `Pais_idPais`) , INDEX `fk_Provincia_Pais1` (`Pais_idPais` ASC) , CONSTRAINT `fk_Provincia_Pais1` FOREIGN KEY (`Pais_idPais` ) REFERENCES `ucanDB`.`Pais` (`idPais` ) ON DELETE NO ACTION ON UPDATE NO ACTION)
ENGINE = InnoDB;
-- -----------------------------------------------------
-- Table `ucanDB`.`Municipio`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `ucanDB`.`Municipio` ( `idMunicipio` INT NOT NULL AUTO_INCREMENT , `nomeMunicipio` VARCHAR(45) NULL , `Provincia_idProvincia` INT NOT NULL , PRIMARY KEY (`idMunicipio`, `Provincia_idProvincia`) , INDEX `fk_Municipio_Provincia1` (`Provincia_idProvincia` ASC) , CONSTRAINT `fk_Municipio_Provincia1` FOREIGN KEY (`Provincia_idProvincia` ) REFERENCES `ucanDB`.`Provincia` (`idProvincia` ) ON DELETE NO ACTION ON UPDATE NO ACTION)
ENGINE = InnoDB;
-- -----------------------------------------------------
-- Table `ucanDB`.`Utilizador`