当前位置:网站首页>数据库中显示error1822,error1824
数据库中显示error1822,error1824
2022-06-25 12:43:00 【CSDN问答】
运行的时候显示order那里ERROR 1822 : Failed to add the foreign key constraint. Missing index for constraint ‘orderitem_ibfk_1’ in the referenced table ‘orders’,在网上搜了一下,看见要检查外键是否是另外的表的主键,但是都是呀,这是怎么回事啊
我后面又把order表注释掉,显示c_sevice那个表ERROR 1824 : Failed to open the referenced table 'fastfood_shop'又是咋回事啊
CREATE TABLE admin_login(admin_id varchar(50) NOT NULL,admin_pass varchar(50) DEFAULT NULL,
PRIMARY KEY (admin_id)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE order1(cons_phone varchar(50) NOT NULL,service_id varchar(50) NOT NULL,order_id varchar(50) NOT NULL,forder_money varchar(50) DEFAULT NULL,order_way varchar(50) DEFAULT NULL,cons_name varchar(50) DEFAULT NULL,cons_addre varchar(50) NOT NULL,
PRIMARY KEY (cons_phone,service_id),
FOREIGN KEY (cons_phone) REFERENCES order1 (cons_phone),
FOREIGN KEY (service_id) REFERENCES c_service (c_service_id)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE c_service(c_service_id varchar(50) NOT NULL,c_service_name varchar(50) NOT NULL,fastfood_shop_name varchar(50) NOT NULL,
PRIMARY KEY (c_service_id),
FOREIGN KEY (fastfood_shop_name) REFERENCES fastfood_shop(shop_name)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE fastfood_shop(shop_name varchar(50) NOT NULL,m_sale_v varchar(50) NOT NULL,
PRIMARY KEY (shop_name)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE dispatcher(dispatcher_id varchar(50) NOT NULL,dispatcher_name varchar(50) NOT NULL,dispatcher_phone varchar(50) NOT NULL,fastfood_shop_namel varchar(50) NOT NULL,
PRIMARY KEY (dispatcher_id),
FOREIGN KEY (fastfood_shop_namel) REFERENCES fastfood_shop(shop_name)
)ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE wuliu(cons_phonel varchar(50) NOT NULL,disp_id varchar(50) NOT NULL,deliver_time varchar(50) DEFAULT NULL,
PRIMARY KEY (cons_phonel,disp_id),
FOREIGN KEY (cons_phonel) REFERENCES order1(cons_phone),
FOREIGN KEY (disp_id) REFERENCES dispatcher(dispatcher_id)
)ENGINE=InnoDB DEFAULT CHARSET=utf8;
边栏推荐
- leetcode:918. 环形子数组的最大和【逆向思维 + 最大子数组和】
- Maui's learning path (II) -- setting
- 关于三子棋游戏的简易实现与N子棋胜利判断方法
- How to determine if a web worker has been created or closed
- Cold migration and resize of Nova component source code analysis
- Where is it safe to open an account for buying funds? Please give me your advice
- Component: is to switch between multiple components
- Detailed explanation of string operation functions and memory functions
- Optimization of lazyagg query rewriting in parsing data warehouse
- The priority of catch() and then (..., ERR) of promise
猜你喜欢

关于一个图书小系统的实现
![[flask tutorial] flask development foundation and introduction](/img/c4/fb80fbe6b563e3b304d59623ef6465.jpg)
[flask tutorial] flask development foundation and introduction

Maui的学习之路(二)--设置

Pointer, it has to say that the subject

Conway's law can not be flexibly applied as an architect?

药物设计新福音:腾讯联合中科大、浙大开发自适应图学习方法,预测分子相互作用及分子性质

数据在内存中的存储相关内容

數據在內存中的存儲相關內容

Three lines of code to simply modify the project code of the jar package

Discuz仿今日头条模板/Discuz新闻资讯商业版GBK模板
随机推荐
重磅直播|BizDevOps:数字化转型浪潮下的技术破局之路
Seven competencies required by architects
It's an artifact to launch a website in a few minutes
How to configure aliases for typescript + vite projects
Sword finger offer day 2 linked list (simple)
Using swiper to realize seamless rotation of multiple slides
關於一道教材題的講解
KDD 2022 | graphmae: self supervised mask map self encoder
[pit avoidance refers to "difficult"] antd cascader implements new customized functions
數據在內存中的存儲相關內容
Stockage des données en mémoire
[turn] starting from the end, analyze in detail how to fill in the college entrance examination volunteer
Serenvlt first met
Unity 2D游戏中的抛物运动
The starting point for learning programming.
关于猜数字游戏的实现
leetcode - 384. Scramble array
OpenStack学习笔记之-Nova组件深入了解
ByteDance dev better technology salon is coming! Participate in the activity to win a good gift, and sign up for free within a limited time!
There is a problem with the date when MySQL imports and exports data to excel