Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8528783
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T08:52:47+00:00 2026-06-11T08:52:47+00:00

I’m modeling my database with MySQL Wordbench in a EER Model, which is this

  • 0

I’m modeling my database with MySQL Wordbench in a EER Model, which is this :

system

So after modeling my database I export to a SQL script and try to run it, but it creates only three tables:

tables

Why is that happening ?
It shouldn’t create all tables ?

This is the generated script when I export:

    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';

CREATE SCHEMA IF NOT EXISTS `brainset` DEFAULT CHARACTER SET latin1 COLLATE latin1_general_ci ;
USE `brainset` ;

-- -----------------------------------------------------
-- Table `brainset`.`departamento`
-- -----------------------------------------------------
CREATE  TABLE IF NOT EXISTS `brainset`.`departamento` (
  `ID` TINYINT UNSIGNED NOT NULL ,
  `departamento` VARCHAR(50) NOT NULL ,
  PRIMARY KEY (`ID`) ,
  UNIQUE INDEX `departamento_UNIQUE` (`departamento` ASC) )
ENGINE = InnoDB;


-- -----------------------------------------------------
-- Table `brainset`.`documento_escopo`
-- -----------------------------------------------------
CREATE  TABLE IF NOT EXISTS `brainset`.`documento_escopo` (
  `ID` TINYINT UNSIGNED NOT NULL ,
  `escopo` CHAR(7) NOT NULL ,
  PRIMARY KEY (`ID`) ,
  UNIQUE INDEX `escopo_UNIQUE` (`escopo` ASC) )
ENGINE = InnoDB;


-- -----------------------------------------------------
-- Table `brainset`.`procedimento_tipo`
-- -----------------------------------------------------
CREATE  TABLE IF NOT EXISTS `brainset`.`procedimento_tipo` (
  `ID` TINYINT UNSIGNED NOT NULL ,
  `tipo` VARCHAR(50) NOT NULL ,
  PRIMARY KEY (`ID`) ,
  UNIQUE INDEX `tipo_UNIQUE` (`tipo` ASC) )
ENGINE = InnoDB
COMMENT = '     ';


-- -----------------------------------------------------
-- Table `brainset`.`procedimento`
-- -----------------------------------------------------
CREATE  TABLE IF NOT EXISTS `brainset`.`procedimento` (
  `ID` SMALLINT UNSIGNED NOT NULL ,
  `nome` VARCHAR(100) NOT NULL ,
  `descricao` VARCHAR(1024) NOT NULL ,
  `id_tipo` TINYINT UNSIGNED NOT NULL ,
  `id_departamento` TINYINT UNSIGNED NOT NULL ,
  `id_documento_complementar` INT UNSIGNED NOT NULL ,
  PRIMARY KEY (`ID`) ,
  INDEX `fk_procedimento-procedimento_tipo` (`id_tipo` ASC, `id_departamento` ASC) ,
  INDEX `fk_procedimento-departamento` (`id_departamento` ASC) ,
  CONSTRAINT `fk_procedimento-procedimento_tipo`
    FOREIGN KEY (`id_tipo` , `id_departamento` )
    REFERENCES `brainset`.`procedimento_tipo` (`ID` , `ID` )
    ON DELETE NO ACTION
    ON UPDATE NO ACTION,
  CONSTRAINT `fk_procedimento-departamento`
    FOREIGN KEY (`id_departamento` )
    REFERENCES `brainset`.`departamento` (`ID` )
    ON DELETE NO ACTION
    ON UPDATE NO ACTION)
ENGINE = InnoDB;


-- -----------------------------------------------------
-- Table `brainset`.`usuario`
-- -----------------------------------------------------
CREATE  TABLE IF NOT EXISTS `brainset`.`usuario` (
  `ID` INT UNSIGNED NOT NULL AUTO_INCREMENT ,
  `nome` VARCHAR(100) NOT NULL ,
  `foto` VARCHAR(200) NULL ,
  `email` VARCHAR(45) NOT NULL ,
  `senha` VARCHAR(45) NOT NULL ,
  PRIMARY KEY (`ID`) )
ENGINE = InnoDB;


-- -----------------------------------------------------
-- Table `brainset`.`documento`
-- -----------------------------------------------------
CREATE  TABLE IF NOT EXISTS `brainset`.`documento` (
  `ID` INT UNSIGNED NOT NULL AUTO_INCREMENT ,
  `id_procedimento` SMALLINT UNSIGNED NOT NULL ,
  `data` DATETIME NOT NULL ,
  `revisao` TINYINT NOT NULL ,
  `id_escopo` TINYINT UNSIGNED NOT NULL ,
  `id_documento_complementar` INT UNSIGNED NULL ,
  `id_usuario` INT UNSIGNED NOT NULL ,
  PRIMARY KEY (`ID`) ,
  INDEX `fk_documento-documento_escopo` (`id_escopo` ASC) ,
  INDEX `fk_documento-procedimento` (`id_procedimento` ASC) ,
  INDEX `fk_documento-documento` (`id_documento_complementar` ASC) ,
  INDEX `fk_documento-usuario` (`id_usuario` ASC) ,
  CONSTRAINT `fk_documento-documento_escopo`
    FOREIGN KEY (`id_escopo` )
    REFERENCES `brainset`.`documento_escopo` (`ID` )
    ON DELETE NO ACTION
    ON UPDATE NO ACTION,
  CONSTRAINT `fk_documento-procedimento`
    FOREIGN KEY (`id_procedimento` )
    REFERENCES `brainset`.`procedimento` (`ID` )
    ON DELETE NO ACTION
    ON UPDATE NO ACTION,
  CONSTRAINT `fk_documento-documento`
    FOREIGN KEY (`id_documento_complementar` )
    REFERENCES `brainset`.`documento` (`ID` )
    ON DELETE NO ACTION
    ON UPDATE NO ACTION,
  CONSTRAINT `fk_documento-usuario`
    FOREIGN KEY (`id_usuario` )
    REFERENCES `brainset`.`usuario` (`ID` )
    ON DELETE NO ACTION
    ON UPDATE NO ACTION)
ENGINE = InnoDB;


-- -----------------------------------------------------
-- Table `brainset`.`questao`
-- -----------------------------------------------------
CREATE  TABLE IF NOT EXISTS `brainset`.`questao` (
  `ID` INT UNSIGNED NOT NULL ,
  `questao` VARCHAR(1024) NOT NULL ,
  `descricao` VARCHAR(1024) NULL ,
  `observacao` VARCHAR(1024) NULL ,
  `data` DATETIME NOT NULL ,
  PRIMARY KEY (`ID`) )
ENGINE = InnoDB;


-- -----------------------------------------------------
-- Table `brainset`.`questao_tipo`
-- -----------------------------------------------------
CREATE  TABLE IF NOT EXISTS `brainset`.`questao_tipo` (
  `ID` TINYINT UNSIGNED NOT NULL ,
  `nome` VARCHAR(45) NOT NULL ,
  PRIMARY KEY (`ID`) )
ENGINE = InnoDB;


-- -----------------------------------------------------
-- Table `brainset`.`questao_campo`
-- -----------------------------------------------------
CREATE  TABLE IF NOT EXISTS `brainset`.`questao_campo` (
  `ID` INT UNSIGNED NOT NULL ,
  `id_questao` INT NOT NULL ,
  `id_questao_tipo` TINYINT NOT NULL ,
  `descricao` VARCHAR(1024) NULL ,
  PRIMARY KEY (`ID`) ,
  INDEX `fk_questao_campo-questao` (`id_questao` ASC) ,
  INDEX `fk_questao_campo-questao-tipo` (`id_questao_tipo` ASC) ,
  CONSTRAINT `fk_questao_campo-questao`
    FOREIGN KEY (`id_questao` )
    REFERENCES `brainset`.`questao` (`ID` )
    ON DELETE CASCADE
    ON UPDATE CASCADE,
  CONSTRAINT `fk_questao_campo-questao-tipo`
    FOREIGN KEY (`id_questao_tipo` )
    REFERENCES `brainset`.`questao_tipo` (`ID` )
    ON DELETE NO ACTION
    ON UPDATE NO ACTION)
ENGINE = InnoDB;


-- -----------------------------------------------------
-- Table `brainset`.`questao_escolha`
-- -----------------------------------------------------
CREATE  TABLE IF NOT EXISTS `brainset`.`questao_escolha` (
  `ID` INT UNSIGNED NOT NULL ,
  `id_questao_campo` INT NOT NULL ,
  `nome` VARCHAR(64) NOT NULL ,
  `valor` VARCHAR(64) NOT NULL ,
  PRIMARY KEY (`ID`) ,
  INDEX `fk_questao_escolha-questao_campo` (`id_questao_campo` ASC) ,
  CONSTRAINT `fk_questao_escolha-questao_campo`
    FOREIGN KEY (`id_questao_campo` )
    REFERENCES `brainset`.`questao_campo` (`ID` )
    ON DELETE NO ACTION
    ON UPDATE NO ACTION)
ENGINE = InnoDB;


-- -----------------------------------------------------
-- Table `brainset`.`questao_resposta`
-- -----------------------------------------------------
CREATE  TABLE IF NOT EXISTS `brainset`.`questao_resposta` (
  `ID` INT UNSIGNED NOT NULL ,
  `id_questao` INT NOT NULL ,
  `resposta` VARCHAR(1024) NOT NULL ,
  `data` DATETIME NOT NULL ,
  PRIMARY KEY (`ID`) )
ENGINE = InnoDB;


-- -----------------------------------------------------
-- Table `brainset`.`questao_consulta`
-- -----------------------------------------------------
CREATE  TABLE IF NOT EXISTS `brainset`.`questao_consulta` (
  `ID` INT UNSIGNED NOT NULL ,
  `id_usuario` INT NOT NULL ,
  `id_questao` INT NOT NULL ,
  `id_questao_resposta` INT NOT NULL ,
  `data` TIMESTAMP NOT NULL ,
  PRIMARY KEY (`ID`) ,
  INDEX `fk_questao_consulta-usuario` (`id_usuario` ASC) ,
  INDEX `fk_questao_consulta-questao` (`id_questao` ASC) ,
  INDEX `fk_questao_consulta-questao_resposta` (`id_questao_resposta` ASC) ,
  CONSTRAINT `fk_questao_consulta-usuario`
    FOREIGN KEY (`id_usuario` )
    REFERENCES `brainset`.`usuario` (`ID` )
    ON DELETE NO ACTION
    ON UPDATE NO ACTION,
  CONSTRAINT `fk_questao_consulta-questao`
    FOREIGN KEY (`id_questao` )
    REFERENCES `brainset`.`questao` (`ID` )
    ON DELETE NO ACTION
    ON UPDATE NO ACTION,
  CONSTRAINT `fk_questao_consulta-questao_resposta`
    FOREIGN KEY (`id_questao_resposta` )
    REFERENCES `brainset`.`questao_resposta` (`ID` )
    ON DELETE NO ACTION
    ON UPDATE NO ACTION)
ENGINE = InnoDB
COMMENT = '     ';


-- -----------------------------------------------------
-- Table `brainset`.`departamento_equipe`
-- -----------------------------------------------------
CREATE  TABLE IF NOT EXISTS `brainset`.`departamento_equipe` (
  `ID` INT UNSIGNED NOT NULL ,
  `id_departamento` TINYINT UNSIGNED NOT NULL ,
  `id_usuario` INT UNSIGNED NOT NULL ,
  PRIMARY KEY (`ID`) ,
  INDEX `fk_departamento_equipe-departamento` (`id_departamento` ASC) ,
  INDEX `fk_departamento_equipe-usuario` (`id_usuario` ASC) ,
  CONSTRAINT `fk_departamento_equipe-departamento`
    FOREIGN KEY (`id_departamento` )
    REFERENCES `brainset`.`departamento` (`ID` )
    ON DELETE CASCADE
    ON UPDATE CASCADE,
  CONSTRAINT `fk_departamento_equipe-usuario`
    FOREIGN KEY (`id_usuario` )
    REFERENCES `brainset`.`usuario` (`ID` )
    ON DELETE CASCADE
    ON UPDATE CASCADE)
ENGINE = InnoDB;



SET SQL_MODE=@OLD_SQL_MODE;
SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS;
SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS;

Thanks.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T08:52:49+00:00Added an answer on June 11, 2026 at 8:52 am

    Just in case anyone stumbles upon this; you can’t create a table with a relation to a table that’s not created yet.

    When MySQL creates a relation it links the table you’re creating the relation for to the table you’re referencing, if the referencing table doesn’t exist, MySQL won’t be happy about it.

    So when creating a lot of tables that reference each other, make sure that any table that is referenced by another is created before the table that references it.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

For some reason, after submitting a string like this Jack’s Spindle from a text
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I would like to run a str_replace or preg_replace which looks for certain words
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I have an autohotkey script which looks up a word in a bilingual dictionary
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I am trying to understand how to use SyndicationItem to display feed which is
I used javascript for loading a picture on my website depending on which small
this is what i have right now Drawing an RSS feed into the php,
I have this code to decode numeric html entities to the UTF8 equivalent character.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.