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 103853
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T01:11:22+00:00 2026-05-11T01:11:22+00:00

I used MySQL Workbench to generate a database and now I inserted it into

  • 0

I used MySQL Workbench to generate a database and now I inserted it into the command-line client using:

mysql> . C:\Documents and Settings\kdegroote\My Documents\School\2008-2009\ICT2 \Gegevensbanken\Labo\Hoofdstuk 3 oef 6\pizzasecondtry.sql

For some reason, the last table won’t be accepted. ‘Cannot create table’ is the error message.

I manually editted the data to basically be the same, just without the special options Workbench adds to it and it worked like that.

I’ve been studying the original but I don’t understand why it won’t show me the tables. So I was wondering if anybody here could have a look at it. Maybe someone else will see what I’m overlooking.

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 `PizzaDelivery` DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci; USE `PizzaDelivery`;   CREATE TABLE IF NOT EXISTS `PizzaDelivery`.`Visitors` (   `visitor_id` INT NOT NULL AUTO_INCREMENT ,   `name` VARCHAR(45) NOT NULL ,   `adres` VARCHAR(45) NOT NULL ,   `telephone` MEDIUMBLOB NOT NULL ,   `email` VARCHAR(45) NOT NULL ,   PRIMARY KEY (`visitor_id`))ENGINE=InnoDB;   CREATE TABLE IF NOT EXISTS `PizzaDelivery`.`Employees` (   `employee_id` INT NOT NULL AUTO_INCREMENT ,   `name` VARCHAR(45) NOT NULL ,   PRIMARY KEY (`employee_id`))ENGINE=InnoDB;   CREATE TABLE IF NOT EXISTS `PizzaDelivery`.`Orders` (   `order_id` INT NOT NULL AUTO_INCREMENT ,   `pizza` VARCHAR(45) NOT NULL ,   `extra` VARCHAR(45) NULL ,   `kind` VARCHAR(45) NOT NULL ,   `amount` VARCHAR(45) NOT NULL ,   `visitor_id` INT NOT NULL ,   `employee_id` INT NOT NULL ,   `order_time` TIME NOT NULL ,   PRIMARY KEY (`order_id`) ,   INDEX `visitor_id` (`visitor_id` ASC) ,   INDEX `employee_id` (`employee_id` ASC) ,   CONSTRAINT `visitor_id`     FOREIGN KEY (`visitor_id` )     REFERENCES `PizzaDelivery`.`Visitors` (`visitor_id` )     ON DELETE NO ACTION     ON UPDATE NO ACTION,   CONSTRAINT `employee_id`     FOREIGN KEY (`employee_id` )     REFERENCES `PizzaDelivery`.`Employees` (`employee_id` )     ON DELETE NO ACTION     ON UPDATE NO ACTION)ENGINE=InnoDB;   CREATE TABLE IF NOT EXISTS `PizzaDelivery`.`Deliveries` (   `employee_id` INT NOT NULL ,   `order_id` INT NOT NULL ,   `voertuig_id` INT NOT NULL ,   `deliverytime` TIME NOT NULL ,   PRIMARY KEY (`employee_id`, `order_id`) ,   INDEX `employee_id` (`employee_id` ASC) ,   INDEX `order_id` (`order_id` ASC) ,   CONSTRAINT `employee_id`     FOREIGN KEY (`employee_id` )     REFERENCES `PizzaDelivery`.`Employees` (`employee_id` )     ON DELETE NO ACTION     ON UPDATE NO ACTION,   CONSTRAINT `order_id`     FOREIGN KEY (`order_id` )     REFERENCES `PizzaDelivery`.`Orders` (`order_id` )     ON DELETE NO ACTION     ON UPDATE NO ACTION)ENGINE=InnoDB;  SET SQL_MODE=@OLD_SQL_MODE; SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS; SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS; 
  • 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. 2026-05-11T01:11:22+00:00Added an answer on May 11, 2026 at 1:11 am

    You can often get more information from an InnoDB error like this:

    mysql> SHOW ENGINE INNODB STATUS; 

    The output is long, but among the status output I saw this:

    ------------------------ LATEST FOREIGN KEY ERROR ------------------------ 081221 12:02:36 Error in foreign key constraint creation  for table `pizzadelivery/deliveries`. A foreign key constraint of name `pizzadelivery/employee_id` already exists.  

    The problem is that the Deliveries and the Orders tables both declare a foreign key constraint named employee_id.

    Constraint names must be unique across all tables in a given database. The ‘errno: 121’ is an InnoDB error code indicating a duplicate key error. In this case, the uniqueness of constraint names is not satisfied.

    You can fix this problem and still keep your foreign key constraints if you just change the name of the declared constraint, for example:

    CREATE TABLE IF NOT EXISTS `PizzaDelivery`.`Deliveries` (   . . .   CONSTRAINT `employee_id2`     FOREIGN KEY (`employee_id` )   . . . 
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 78k
  • Answers 79k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • added an answer Try this. May 11, 2026 at 3:58 pm
  • added an answer You should use an inline tag like <span> May 11, 2026 at 3:58 pm
  • added an answer Does it have to be done within vim? Could you… May 11, 2026 at 3:58 pm

Related Questions

Is it possible to generate model in Propel using Schema.xml, instead of Schema.yml ?
Is SQL case sensitive? I've used MySQL and SQL Server which both seem to
Did the recent purchase of MySQL by Sun and the subsequent buggy releases kill
I'm trying to create and retrieve a BLOB in a MySQL table via Kohana's

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.