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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T14:26:54+00:00 2026-06-09T14:26:54+00:00

I would like to ask something that troubles me many many days… Here is

  • 0

I would like to ask something that troubles me many many days…

Here is what I mean:

I create these two tables:

CREATE TABLE IF NOT EXISTS journal (
  issn varchar(20) NOT NULL,
  j_title varchar(100) NOT NULL,
  j_publisher varchar(30) NOT NULL,
  PRIMARY KEY (issn)
) ENGINE=InnoDB;

CREATE TABLE IF NOT EXISTS volume (
  volume_no int(11) NOT NULL,
  issn varchar(20) NOT NULL,
  year int(11) NOT NULL,
  PRIMARY KEY (issn,volume_no),
  FOREIGN KEY (issn) REFERENCES journal(issn)
) ENGINE=InnoDB;

When I try to create this:

CREATE TABLE IF NOT EXISTS issue (
  issue_no int(11) NOT NULL,
  issue_pages varchar(10) NOT NULL,
  issue_date varchar(10) NOT NULL,
  issn varchar(20) NOT NULL,
  volume_no int(11) NOT NULL,
  PRIMARY KEY (issue_no,issn,volume_no),
  FOREIGN KEY (issn) REFERENCES journal(issn),
  FOREIGN KEY (volume_no) REFERENCES volume(volume_no)
) ENGINE=InnoDB;

it throws an error (errno 150)

The error is in the foreign key volume_no.

Without FOREIGN KEY (volume_no) REFERENCES volume(volume_no)

the table is created without a problem…. I can’t explain what’s going on… I have seen it many times again and again but nothing!! Does anybody know what’s going on?

Thanks in advance!!

  • 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-09T14:26:56+00:00Added an answer on June 9, 2026 at 2:26 pm

    I could see that the foreign key doesnt include issn but which is actually included in primary key for volumn table.

    CREATE TABLE IF NOT EXISTS issue (   issue_no int(11) NOT NULL,  
                                      issue_pages varchar(10) NOT NULL,   
                                      issue_date varchar(10) NOT NULL,  
                                      issn varchar(20) NOT NULL,  
                                      volume_no int(11) NOT NULL,   
                                      PRIMARY KEY (issue_no,issn,volume_no),   
                                      FOREIGN KEY (issn,volume_no) REFERENCES volume(issn,volume_no) ) ENGINE=InnoDB; 
    

    Look at the below sql fiddle.
    http://sqlfiddle.com/#!2/55a63

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

Sidebar

Related Questions

Here's something I would like to ask about the JVM: Is there any free
I have already posted something similar here but I would like to ask the
I would like to make my application ask the user some informations via something
I would like to ask you: Imagine that you have a site and there
there is something that confuses me a little bit and i would like some
I would like to ask something about query using mysql I have this table
I'm new to Android app development and I would like to ask something. I
I would like to ask you if you know any concrete library that is
I am still new to silverlight and would like to ask few questions that
I would like to ask for 3 information here: There is no integrated solution

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.