当前位置:网站首页>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;
边栏推荐
- 类加载机制
- GB28181的NAT穿透
- Optaplanner learning notes (I) case cloud balance
- 【英语语法】Unit1 冠词、名词、代词和数词
- Parallelism, concurrency and life cycle of threads
- 数字化转型企业成功的关键,用数据创造价值
- Extensive reading of the paper [film: visual reasoning with a general condition layer]
- sql查询去重统计的方法总结
- [info() method in org.slf4j.logger]
- Ffmpeg audio related commands
猜你喜欢

Case sharing: basic networking configuration of QinQ

精耕渠道共謀發展 福昕攜手偉仕佳傑開展新產品培訓大會

测试自学人必看:软件测试如何找测试项目?

sql查询去重统计的方法总结

The use of subplot function in MATLAB

新版国标GB28181视频平台EasyGBS如何配置WebRTC视频流格式播放?

Intensive cultivation of channels for joint development Fuxin and Weishi Jiajie held a new product training conference

Salesmartly has some tricks for Facebook chat!

Enabling "new Chinese enterprises", SAP process automation landing in China

【AI服务器搭建】CUDA环境
随机推荐
Solidity - contract structure - error - ^0.8.4 NEW
Opencv video quality detection -- sharpness detection
Test self-study people must see: how to find test items in software testing?
Wechat applet navigator has a shadow after clicking. Remove the shadow effect of navigator
【org.slf4j.Logger中info()方法】
Crunch简介、安装,使用Crunch制作密码字典
DTD modeling
wireshark报文分析tcp,ftp
[to.Net] C set class source code analysis
[go ~ 0 to 1] day 5 July 1 type alias, custom type, interface, package and initialization function
【无标题】
[Mori city] random talk on GIS data (I)
【英语语法】Unit1 冠词、名词、代词和数词
H264编码profile & level控制
703. 数据流中的第 K 大元素
【AI服务器搭建】CUDA环境
The key to the success of digital transformation enterprises is to create value with data
ubuntu14安装MySQL并配置root账户本地与远程访问
Thesis reading [distinctive late semantic graph for video capturing]
Flutter 实战-快速实现音视频通话应用