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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T03:08:00+00:00 2026-06-01T03:08:00+00:00

I’m modeling my db shema using MySQL Workbench CE EER modeler and now I’m

  • 0

I’m modeling my db shema using MySQL Workbench CE EER modeler and now I’m stuck with mysql errno 150.

My sql code:

CREATE  TABLE `myschema`.`Clients` (
  `phone` VARCHAR(15) NOT NULL ,
  `surname` VARCHAR(30) NOT NULL ,
  `name` VARCHAR(30) NOT NULL ,
  `middleName` VARCHAR(30) NULL ,
  `discountCardNumber` BIGINT NULL ,
  PRIMARY KEY (`phone`) ,
  UNIQUE INDEX `discountCardNumber_UNIQUE` (`discountCardNumber` ASC) ,
  CONSTRAINT `fk_Clients_DiscountCards1`
    FOREIGN KEY (`discountCardNumber` )
    REFERENCES `myschema`.`DiscountCards` (`cardNumber` )
    ON DELETE SET NULL
    ON UPDATE CASCADE)
ENGINE = InnoDB;

CREATE  TABLE `myschema`.`OrderStatuses` (
  `statusID` INT NOT NULL AUTO_INCREMENT ,
  `statusTitle` VARCHAR(45) NOT NULL ,
  `statusDescription` VARCHAR(150) NULL ,
  PRIMARY KEY (`statusID`) )
ENGINE = InnoDB;

CREATE  TABLE IF NOT EXISTS `myschema`.`WorkstationUsers` (
  `userID` INT NOT NULL AUTO_INCREMENT ,
  `login` VARCHAR(45) NOT NULL ,
  `pass` VARCHAR(45) NOT NULL ,
  `name` VARCHAR(45) NOT NULL ,
  `surname` VARCHAR(45) NOT NULL ,
  `middleName` VARCHAR(45) NULL ,
  PRIMARY KEY (`userID`) )
ENGINE = InnoDB;

CREATE TABLE `myschema`.`Orders` (
  `orderID` BIGINT NOT NULL AUTO_INCREMENT ,
  `registerDate` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ,
  `clientPhone` VARCHAR(15) NOT NULL ,
  `shipmentAddress` VARCHAR(150) NOT NULL ,
  `orderStatus` INT NOT NULL ,
  `registrator` INT NOT NULL ,
  PRIMARY KEY (`orderID`) ,
  INDEX `fk_Orders_Clients` (`clientPhone` ASC) ,
  INDEX `fk_Orders_OrderStatuses1` (`orderStatus` ASC) ,
  INDEX `fk_Orders_WorkstationUsers1` (`registrator` ASC) ,
  CONSTRAINT `fk_Orders_Clients`
    FOREIGN KEY (`clientPhone` )
    REFERENCES `myschema`.`Clients` (`phone` )
    ON DELETE SET NULL
    ON UPDATE CASCADE,
  CONSTRAINT `fk_Orders_OrderStatuses1`
    FOREIGN KEY (`orderStatus` )
    REFERENCES `myschema`.`OrderStatuses` (`statusID` )
    ON DELETE SET NULL
    ON UPDATE CASCADE,
  CONSTRAINT `fk_Orders_WorkstationUsers1`
    FOREIGN KEY (`registrator` )
    REFERENCES `myschema`.`WorkstationUsers` (`userID` )
    ON DELETE SET NULL
    ON UPDATE CASCADE)
ENGINE = InnoDB;

It fails in last statement (CREATE TABLE Orders).

I already checked:

  • Types of refferencing tables are equals
  • Indexes on all columns exists
  • Engine is InnoDB

Thanks for any help! Have a good day!

P.S. sorry for possible duplicate. I really can’t find any problem in my code.

  • 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-01T03:08:02+00:00Added an answer on June 1, 2026 at 3:08 am

    Some of fields are defined as NOT NULL, but you defined ‘ON DELETE’ action as ‘SET NULL’.

    Make these fields nullabe –

    CREATE TABLE `myschema`.`Orders` (
      `orderID` BIGINT NOT NULL AUTO_INCREMENT ,
      `registerDate` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ,
      `clientPhone` VARCHAR(15) NULL, -- NOT NULL ,
      `shipmentAddress` VARCHAR(150) NOT NULL ,
      `orderStatus` INT NULL, -- NOT NULL ,
      `registrator` INT NULL, -- NOT NULL ,
      PRIMARY KEY (`orderID`) ,
      INDEX `fk_Orders_Clients` (`clientPhone` ASC) ,
      INDEX `fk_Orders_OrderStatuses1` (`orderStatus` ASC) ,
      INDEX `fk_Orders_WorkstationUsers1` (`registrator` ASC) ,
      CONSTRAINT `fk_Orders_Clients`
        FOREIGN KEY (`clientPhone` )
        REFERENCES `myschema`.`Clients` (`phone` )
        ON DELETE SET NULL
        ON UPDATE CASCADE,
      CONSTRAINT `fk_Orders_OrderStatuses1`
        FOREIGN KEY (`orderStatus` )
        REFERENCES `myschema`.`OrderStatuses` (`statusID` )
        ON DELETE SET NULL
        ON UPDATE CASCADE,
      CONSTRAINT `fk_Orders_WorkstationUsers1`
        FOREIGN KEY (`registrator` )
        REFERENCES `myschema`.`WorkstationUsers` (`userID` )
        ON DELETE SET NULL
        ON UPDATE CASCADE)
    ENGINE = InnoDB;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have a jquery bug and I've been looking for hours now, I can't
Basically, what I'm trying to create is a page of div tags, each has
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
this is what i have right now Drawing an RSS feed into the php,
I am reading a book about Javascript and jQuery and using one of the
I have this code to decode numeric html entities to the UTF8 equivalent character.
I'm using v2.0 of ClassTextile.php, with the following call: $testimonial_text = $textile->TextileRestricted($_POST['testimonial']); ... and
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this

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.