当前位置:网站首页>MySQL signale une erreur can 't create table' demo01. TB Étudiant '(errno: 150)
MySQL signale une erreur can 't create table' demo01. TB Étudiant '(errno: 150)
2022-07-01 19:40:00 【Désir et Yu Yu Yu】
mysql Erreur détectée lors de l'ajout d'une clé étrangère 150
Conseils:mysql Erreur détectée lors de l'ajout d'une clé étrangère ,Mais le type de clé étrangère est le même,Et ce champ existe dans une autre table
Contenu des erreurs signalées:Can’t create table ‘demo01.tb_Student’ (errno: 150)
Introduction à l'utilisation des clés étrangères:
CONSTRAINT Fk_Class_Student FOREIGN KEY(classId) references tb_class(classId)
CONSTRAINT Nom de la contrainte FOREIGN KEY(Nom de la clé étrangère) references Nom de la table à associer à la clé étrangère(Nom du champ)
CREATE TABLE tb_class(
classId int PRIMARY KEY AUTO_Increment,
ClassName varchar(20) not null
);
CREATE TABLE tb_Student(
StudentId int primary key Auto_increment,
StudentName varchar(20),
classId int not NULL,
CONSTRAINT Fk_Class_Student FOREIGN KEY(classId) references tb_class(classId)
)
Solutions:
Conseils:Création tb_StudentAjouter après ENGINE = MYISAM;
CREATE TABLE tb_class(
classId int PRIMARY KEY AUTO_Increment,
ClassName varchar(20) not null
);
CREATE TABLE tb_Student(
StudentId int primary key Auto_increment,
StudentName varchar(20),
classId int not NULL,
CONSTRAINT Fk_Class_Student FOREIGN KEY(classId) references tb_class(classId)
)ENGINE = MYISAM;
边栏推荐
猜你喜欢

GC垃圾回收

求各种极限的方法

Les canaux de culture intensive s'efforcent de développer Fu Xin et Wei Shi jiajie pour organiser une conférence de formation sur les nouveaux produits
![Reading the paper [learning to discretely compose reasoning module networks for video captioning]](/img/a2/acdaebeb67ec4bcb01c8ff4bbd1d1e.png)
Reading the paper [learning to discretely compose reasoning module networks for video captioning]

SIP protocol of gb28181

Oracle物理体系结构

Optaplanner learning notes (I) case cloud balance

音视频、编解码相关电子书、小工具,打包奉送!

What must be done in graduation season before going to Shanhai

Detailed explanation of JUnit unit test framework
随机推荐
Intensive cultivation of channels for joint development Fuxin and Weishi Jiajie held a new product training conference
IPv4 address, subnet mask, gateway
optaplanner学习笔记(一)案例Cloud balance
EasyGBS网络不稳定情况下重复请求视频拉流问题的优化
How to solve the problem of splash screen when the main and sub code streams of easygbs are h.265?
XML syntax, constraints
数字化转型企业成功的关键,用数据创造价值
Ffmpeg error code
wireshark报文分析tcp,ftp
物联网平台thingsboard搭建学习记录
Collation of open source protocols of open source frameworks commonly used in Web Development
DTD modeling
JVM内存模型
Download (export) PDF template file (such as approval form), and report error: invalid nested tag * * * found, expected closing tag***
[Mori city] random talk on GIS data (I)
[go ~ 0 to 1] day 4 June 30 defer, structure, method
703. 数据流中的第 K 大元素
如何正确使用Vertx操作Redis(3.9.4带源码分析)
torch.nn.functional.interpolate函数
The key to the success of digital transformation enterprises is to create value with data