问题描述
我有5张桌子。表1具有主键ID。类似地,其他表也有它们的主键。表1的主键id也是名为faculty_id的其他4个表的外键。现在,表1的id被设置为自动增量。此外,所有表格仅为单个人定义内容(基于表1中的id)。如何在其他faculty_id中插入表1的相同id,外键应自动插入,并且应与主键。但这些外键不是自动增量。因为一个人可以拥有超过1条记录。如何在MySQL中实现这些记录的插入和选择?
I have 5 tables. table 1 has a primary key id. similarly other tables as well have their primary keys. Also the primary key id of table 1 is the foreign key for other 4 tables named as faculty_id.Now this id of table 1 is set as auto increment. Also all the tables will define content only for a single person (based on id in table 1).How to insert the same id of table 1 in the other faculty_id's that is the foreign key should be automatically inserted and should be the same as the primary key.But these foreign keys are not auto increment. Because a single person can have more than 1 records in these. How to achieve insertion and selection of these records in MySQL?
推荐答案
这篇关于相关表的mysql查询的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!