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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T02:04:44+00:00 2026-06-17T02:04:44+00:00

This seems to be a very common problem but I can’t seem to find

  • 0

This seems to be a very common problem but I can’t seem to find an answer despite of all the posts and pseudotutorials I have read in the last 2 days :/

The project I am currently working on forces me to learn how to use MySQL and I seem to have run into a problem concerning ForeignKeys or Indexes.

I have these creates:
http://paste.ubuntu.com/1503473/

Edit: Inserting crutial part here cause the link above might die sometime:

   CREATE TABLE user_book (
        userid  Varbinary(16),
        bookid Varbinary(16),

        PRIMARY KEY(userid, bookid),

        INDEX(userid),
        FOREIGN KEY(userid)  REFERENCES user,

        INDEX (bookid),
        FOREIGN KEY(bookid) REFERENCES book

    )ENGINE=INNODB;

    Made the same mistake at user_chapter.

But sql throws an error at Table “user_book”:
#1005 – Can’t create table ‘mangressdb.user_book’ (errno: 150)

It would be really great if you could help me out here as I am close to crying. It is probably just a very stupid mistake on my part but I can’t find it.

  • 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-17T02:04:46+00:00Added an answer on June 17, 2026 at 2:04 am

    Looks like you are getting name conflicts in your DDL. Try explicitly specifying the parent table columns to be used for the foreign keys:

    CREATE TABLE user_book (
        userid  Varbinary(16),
        bookid Varbinary(16),
    
        PRIMARY KEY(userid, bookid),
    
        INDEX(userid),
        FOREIGN KEY(userid)  REFERENCES user (userid),
    
        INDEX (bookid),
        FOREIGN KEY(bookid) REFERENCES book (bookid)
    
    )ENGINE=INNODB;
    

    You will need to also explicitly specify the parent column names for your user_chapter table.

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

Sidebar

Related Questions

It seems a very common problem. But I couldn't find any working solution. We
This problem seems very simple to me, but I've been unable to fix it,
This seems like it should be very simple but I can't get it to
All the ways I can think to do this seem very hackish. What is
This seems to be a very common problem of mine: data = [1 2
Can't seem to find a solution to this problem. I'm creating an Android app
I am having a very common problem which it seems that all the available
This seem to be a common problem and I went through all the related
This seems very basic and I must be missing something, but here goes anyways...
This seems like it should be something very easy to do, but every time

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.