Home  >  Article  >  Database  >  MySQL Foreign Key Constraint Error 150: Why Can\'t I Create a Foreign Key with Matching Data Types?

MySQL Foreign Key Constraint Error 150: Why Can\'t I Create a Foreign Key with Matching Data Types?

Patricia Arquette
Patricia ArquetteOriginal
2024-11-19 15:10:02706browse

MySQL Foreign Key Constraint Error 150: Why Can't I Create a Foreign Key with Matching Data Types?

MySQL Foreign Key Constraint Error: Errno 150

Problem:

When attempting to create a table with foreign key references, an "Errno 150" error occurs. The data types of the referenced columns and their primary keys appear to be identical.

Code Snippet:

create TABLE Instructors (

ID varchar(10),
First_Name varchar(50) NOT NULL,
Last_Name varchar(50) NOT NULL,
PRIMARY KEY (ID)
);

create table Courses (

Course_Code varchar(10),

The above is the detailed content of MySQL Foreign Key Constraint Error 150: Why Can\'t I Create a Foreign Key with Matching Data Types?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn