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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T04:59:32+00:00 2026-06-15T04:59:32+00:00

I have designed schema with MySQL workbench. But it couldn’t complete Database Synchronize.It can

  • 0

I have designed schema with MySQL workbench.

But it couldn’t complete Database Synchronize.It can create tables with out foreign keys.

I copied SQL from MySQL WorkBench to execute in phpmysqadmin.

CREATE  TABLE IF NOT EXISTS `Books`.`Users` (
`id` INT UNSIGNED NOT NULL AUTO_INCREMENT ,
`mail` VARCHAR(45) NOT NULL ,
`password` VARCHAR(45) NOT NULL ,
`smspassword` VARCHAR(8) NULL ,
`mobile` VARCHAR(16) NULL ,
`type` ENUM('admin','secretery','groupadmin','user') NOT NULL DEFAULT 'user' ,
`securelogin` ENUM('true','false') NULL DEFAULT 'true' ,
PRIMARY KEY (`id`) ,
UNIQUE INDEX `id_UNIQUE` (`id` ASC) ,
UNIQUE INDEX `mail_UNIQUE` (`mail` ASC) )
ENGINE = InnoDB
DEFAULT CHARACTER SET = utf8
COLLATE = utf8_unicode_ci
COMMENT = 'Table to store users data'

Users table created successfully. But following table (Profile) can’t be created.

CREATE  TABLE IF NOT EXISTS `Books`.`Profiles` (
`id` INT NOT NULL AUTO_INCREMENT ,
`firstname` VARCHAR(45) NOT NULL ,
`lastname` VARCHAR(45) NOT NULL ,
`title` VARCHAR(45) NOT NULL ,
`nationalcode` VARCHAR(45) NOT NULL ,
`User_id` INT NOT NULL ,
PRIMARY KEY (`id`, `User_id`) ,
INDEX `fk_Profiles_Users` (`User_id` ASC) ,
CONSTRAINT `fk_Profiles_Users`
FOREIGN KEY (`User_id` )
REFERENCES `Books`.`Users` (`id` )
ON DELETE CASCADE
ON UPDATE CASCADE)
ENGINE = InnoDB
DEFAULT CHARACTER SET = utf8
COLLATE = utf8_unicode_ci

But it will be return:

#1005 – Can’t create table ‘Books.Profiles’ (errno: 150)

Where is the problem, and how should I solve this?

  • 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-15T04:59:33+00:00Added an answer on June 15, 2026 at 4:59 am

    You need to match the primary id column type with the foreign key column type – your primary id in Users is UNSIGNED INT, but your foreign key in Profiles is INT. Try this:

    CREATE TABLE IF NOT EXISTS `Books`.`Profiles` (
         `id` INT NOT NULL AUTO_INCREMENT ,
         `firstname` VARCHAR(45) NOT NULL ,
         `lastname` VARCHAR(45) NOT NULL ,
         `title` VARCHAR(45) NOT NULL ,
         `nationalcode` VARCHAR(45) NOT NULL ,
         `User_id` INT UNSIGNED NOT NULL ,          -- <<= Check the type here!
         PRIMARY KEY (`id`, `User_id`) ,
         INDEX `fk_Profiles_Users` (`User_id` ASC) ,
         CONSTRAINT `fk_Profiles_Users`
             FOREIGN KEY (`User_id` )
             REFERENCES `Books`.`Users` (`id` )
             ON DELETE CASCADE
             ON UPDATE CASCADE)
    ENGINE = InnoDB
    DEFAULT CHARACTER SET = utf8
    COLLATE = utf8_unicode_ci;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have never designed a database/data-model/schema from scratch, especially for a web-application. In some
I have designed a custom section handler before but I'm faced with a problem
I have designed a database whose MDF file will be copied to remote offices,
I have a database designed to hold card data from various trading card games.
I wrongly designed my application to have one database to each user. each user
When I entered my current (employer's) company a new database schema was designed and
I have oracle backend for my application. The schema is designed such that I
I have designed a database with Visio 2010 Professional. I am now looking for
I am using asp.net 2.0 and have a different Sql Database table schema for
I have two tables which share primary keys. I designed poorly, and it turns

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.