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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T00:12:41+00:00 2026-06-13T00:12:41+00:00

I’m working on my first MySQL database for an assignment at my university. Unfortunately

  • 0

I’m working on my first MySQL database for an assignment at my university. Unfortunately I’ve been stuck for a while trying to create the actual tables with foreign keys between them.

This is the error that the MySQL Workbench forward engineering wizard gives:

Executing SQL script in server

ERROR: Error 1005: Can't create table 'test.fremført' (errno: 150)    

CREATE  TABLE IF NOT EXISTS `Fremført` (    
  `Plate` VARCHAR(20) NOT NULL ,
  `Verk` VARCHAR(45) NOT NULL ,
  `Artist` VARCHAR(45) NOT NULL ,
  `Dato` DATE NULL ,
  PRIMARY KEY (`Plate`, `Verk`, `Artist`) ,
  INDEX `Fremført->Artist_idx` (`Artist` ASC) ,
  INDEX `Fremført->Spor_idx` (`Plate` ASC, `Verk` ASC) ,
  CONSTRAINT `Fremført->Artist`
    FOREIGN KEY (`Artist` )
    REFERENCES `Artist` (`ArtistNavn` )
    ON DELETE NO ACTION
    ON UPDATE NO ACTION,
  CONSTRAINT `Fremført->Spor`
    FOREIGN KEY (`Plate` , `Verk` )
    REFERENCES `Spor` (`Verk` , `Verk` )
    ON DELETE NO ACTION
    ON UPDATE NO ACTION)
ENGINE = InnoDB

Does anyone know what’s wrong with the above script, and if so have a solution?

Thanks!

edit:
This is the requested spor query

DROP TABLE IF EXISTS `Spor` ;
CREATE  TABLE IF NOT EXISTS `Spor` (
  `Plate` VARCHAR(45) NOT NULL ,
  `Verk` VARCHAR(45) NOT NULL ,
  `Spilletid` DECIMAL(3,2) NULL ,
  PRIMARY KEY (`Plate`, `Verk`) ,
  INDEX `Plate_idx` (`Plate` ASC) ,
  CONSTRAINT `Plate`
    FOREIGN KEY (`Plate` )
    REFERENCES `Plate` (`KatalogNr` )
    ON DELETE NO ACTION
    ON UPDATE NO ACTION)
ENGINE = InnoDB;



DROP TABLE IF EXISTS `Artist` ;
CREATE  TABLE IF NOT EXISTS `Artist` (
  `ArtistNavn` VARCHAR(30) NOT NULL ,
  `Artistcol` VARCHAR(45) NULL ,
  PRIMARY KEY (`ArtistNavn`) )
ENGINE = InnoDB;
  • 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-13T00:12:42+00:00Added an answer on June 13, 2026 at 12:12 am

    errno150 is very often related to a mismatch between the data types of the primary and related column. They must match exactly, including character length.

    I see a data type mismatch between Fremført.artist (VARCHAR(45)) and Artist.ArtistNavn (VARCHAR(30)). These must be the same for the FOREIGN KEY constraint to succeed.

    CREATE  TABLE IF NOT EXISTS `Fremført` (    
      `Plate` VARCHAR(20) NOT NULL ,
      `Verk` VARCHAR(45) NOT NULL ,
      /* Must match the primary table VARCHAR(30) */
      `Artist` VARCHAR(30) NOT NULL ,
      `Dato` DATE NULL ,
      PRIMARY KEY (`Plate`, `Verk`, `Artist`) ,
      INDEX `Fremført->Artist_idx` (`Artist` ASC) ,
      INDEX `Fremført->Spor_idx` (`Plate` ASC, `Verk` ASC) ,
      CONSTRAINT `Fremført->Artist`
        FOREIGN KEY (`Artist` )
        REFERENCES `Artist` (`ArtistNavn` )
        ON DELETE NO ACTION
        ON UPDATE NO ACTION,
      CONSTRAINT `Fremført->Spor`
        FOREIGN KEY (`Plate` , `Verk` )
        /* Was this intentional, rather than (`Plate`, `Verk`)? */
        /* If not, you must also match the data type of `Plate` VARCHAR(20) to that of Spor.Plate VARCHAR(45) */
        REFERENCES `Spor` (`Verk` , `Verk` )
        ON DELETE NO ACTION
        ON UPDATE NO ACTION)
    ENGINE = InnoDB
    

    As noted above, if the constraint Fremført->Spor was intended to reference Spor (Plate , Verk ) instead of Spor (Verk , Verk ) as you have defined it, then you will also encounter an err150 due to the type mismatch between Spor.Plate and Fremført.Plate. Change Fremført.Plate to VARCHAR(45).

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

Sidebar

Related Questions

I'm trying to create an if statement in PHP that prevents a single post
Let's say I'm outputting a post title and in our database, it's Hello Y’all
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 have a jquery bug and I've been looking for hours now, I can't
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I am trying to render a haml file in a javascript response like so:
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
We're building an app, our first using Rails 3, and we're having to build
I'm trying to select an H1 element which is the second-child in its group

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.