当前位置:网站首页>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;
边栏推荐
- Go Language Advanced
- Summary of SQL query de duplication statistics methods
- Opencv video quality detection -- sharpness detection
- 利用win7漏洞进行系统登录密码破解
- How to configure webrtc video streaming format for easygbs, a new version of national standard gb28181 video platform?
- Uni app product classification
- Ubuntu14 install MySQL and configure root account local and remote access
- Download (export) PDF template file (such as approval form), and report error: invalid nested tag * * * found, expected closing tag***
- 【AI服务器搭建】CUDA环境
- uni-app微信小程序一键登录获取权限功能
猜你喜欢
uni-app商品分类
A brief understanding of white box encryption technology
论文阅读【Discriminative Latent Semantic Graph for Video Captioning】
Optimization of video streaming with repeated requests in the case of unstable easygbs network
Enabling "new Chinese enterprises", SAP process automation landing in China
GC垃圾回收
ddr4测试-2
Shell advanced
Crunch简介、安装,使用Crunch制作密码字典
如何正确使用Vertx操作Redis(3.9.4带源码分析)
随机推荐
Download (export) PDF template file (such as approval form), and report error: invalid nested tag * * * found, expected closing tag***
How to configure webrtc video streaming format for easygbs, a new version of national standard gb28181 video platform?
正则表达式=Regex=regular expression
[info() method in org.slf4j.logger]
Werewolf killing strategy: do you think I'm easy to cheat? Who do we believe!
下载(导出)pdf模板文件(比如:审批单),报错:Invalid nested tag *** found, expected closing tag ***
web开发常用的开源框架的开源协议整理
新版国标GB28181视频平台EasyGBS如何配置WebRTC视频流格式播放?
Dom4j parsing XML, XPath retrieving XML
AAAI2020: Real-time Scene Text Detection with Differentiable Binarization
Nat penetration of gb28181
How to solve the problem of splash screen when the main and sub code streams of easygbs are h.265?
Detailed explanation of JUnit unit test framework
Collect Tiktok video
Go Language Advanced
面试题 16.16. 部分排序-双指针法
Instagram 为何从内容共享平台变成营销工具?独立站卖家如何利用该工具?
Solution and summary of Nacos startup failure
Uni app wechat applet one click login to obtain permission function
测试自学人必看:软件测试如何找测试项目?