Home > Database > Mysql Tutorial > 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
Release: 2024-11-19 15:10:02
Original
751 people have browsed it

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),
Copy after login

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!

source:php.cn
Statement of this Website
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
Latest Articles by Author
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template