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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T21:50:11+00:00 2026-06-16T21:50:11+00:00

I have used MySQL Workbench to model my table and somehow there’s a logic

  • 0

I have used MySQL Workbench to model my table and somehow there’s a logic error in the SQL to create the tables generated by the software.

Here are the codes:

-- -----------------------------------------------------
-- Table `trickani_main`.`user`
-- -----------------------------------------------------
CREATE  TABLE IF NOT EXISTS `trickani_main`.`user` (
  `iduser` INT UNSIGNED NOT NULL AUTO_INCREMENT ,
  `fb_id` VARCHAR(50) NOT NULL ,
  `email` VARCHAR(40) NOT NULL ,
  `first_name` VARCHAR(15) NOT NULL ,
  `gender` VARCHAR(1) NOT NULL ,
  PRIMARY KEY (`iduser`) ,
  UNIQUE INDEX `fb_id_UNIQUE` (`fb_id` ASC) ,
  UNIQUE INDEX `email_UNIQUE` (`email` ASC) )
ENGINE = InnoDB
AUTO_INCREMENT = 1;


-- -----------------------------------------------------
-- Table `trickani_main`.`quiz_list`
-- -----------------------------------------------------
CREATE  TABLE IF NOT EXISTS `trickani_main`.`quiz_list` (
  `id_quiz_list` INT UNSIGNED NOT NULL AUTO_INCREMENT ,
  `difficult` TINYINT(4) NOT NULL ,
  PRIMARY KEY (`id_quiz_list`) )
ENGINE = InnoDB;


-- -----------------------------------------------------
-- Table `trickani_main`.`user_quiz_list`
-- -----------------------------------------------------
CREATE  TABLE IF NOT EXISTS `trickani_main`.`user_quiz_list` (
  `iduser` INT UNSIGNED NOT NULL ,
  `id_quiz_list` INT UNSIGNED NOT NULL ,
  `level_reached` INT UNSIGNED NOT NULL DEFAULT 0 ,
  PRIMARY KEY (`iduser`, `id_quiz_list`) ,
  INDEX `fk_quiz_list_user1_idx` (`iduser` ASC) ,
  INDEX `fk_user_quiz_list_quiz_list1_idx` (`id_quiz_list` ASC) ,
  CONSTRAINT `fk_quiz_list_user1`
    FOREIGN KEY (`iduser` )
    REFERENCES `trickani_main`.`user` (`iduser` )
    ON DELETE CASCADE
    ON UPDATE CASCADE,
  CONSTRAINT `fk_user_quiz_list_quiz_list1`
    FOREIGN KEY (`id_quiz_list` )
    REFERENCES `trickani_main`.`quiz_list` (`id_quiz_list` )
    ON DELETE NO ACTION
    ON UPDATE NO ACTION)
ENGINE = InnoDB
AUTO_INCREMENT = 1;

As result I’m getting the following message:

#1005 – Can’t create table ‘trickani_main.quiz_level’ (errno: 150)

I don’t get it! I can’t see any error even by reading the code itself!

Any help?

  • 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-16T21:50:12+00:00Added an answer on June 16, 2026 at 9:50 pm

    You might want to try making your PKs not unsigned.

    See this question/answer: Adding table with FOREIGN KEY to a MySQL database causes errno 150

    Edit: you might want to try either making all your PKs signed or all your PKs unsigned. My guess is that the definition for quiz_level, which isn’t currently shown in your question, has a PK whose signedness differs from the other tables.

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

Sidebar

Related Questions

I used JPA and mysql. Each table have entity class.I have four tables. Table1
I will have multiple tables used by different projects on the same mySql server.
I have a MySQL database includes a table named 'Task'. and I used Hibernate
I am used to developing in PHP/MySQL and have no experience developing with SQL
I am using MySQL Workbench to create a large database. I keep getting: ERROR:
I have used mysql to join three tables and print the data in an
I'm using MS SQL for a project, but have always used MySql in the
I have used SQL Server & MySQL RDMS databases in my app development. I
I have used python2.6 + MySQL on Windows and there are binaries available. I
I have used sql (mostly mysql) for years but not to a professional standard,

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.