如何在子表中插入记录 [英] How to insert the record in a child table

查看:79
本文介绍了如何在子表中插入记录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有父表和子表与主键和外键关系



如果我在子表中插入记录意味着它显示一些错误。 。

i am having parent table and child table with primary key and foreign key relationship

if i am inserting the record in child table means it is showing some error..

推荐答案

包含主键的表可以称为Parent表,包含外键的表可以称为子表。什么是外键?它是一个引用另一个表主键的键。因此,当此方案出现时,您必须先插入主键。如果没有主键,则外键值无效,只有您可以存储存在于主/父表中的外键值,或者如果它可以为空,则可以存储空值。因此,首先将数据插入主/父表,然后插入外部/子表
The table which contain primary key can called Parent table and the table which contain foreign key can called child table. What is a foreign key? It is a key which refer to another table primary key. So when this scenario comes then you must insert primary key first. Without primary key foreign key value is invalid, only you can store foreign key value that is present to primary/parent table or if it is nullable then can store null. So first insert data to primary/parent table then next insert foreign/child table


这篇关于如何在子表中插入记录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆