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!