需要删除级联查询以一次从3个表中删除数据 [英] Needed delete cascade query to delete data from 3tables at a time

查看:63
本文介绍了需要删除级联查询以一次从3个表中删除数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有3个表(一个表,一个b表,一个c表)

在``a''表中:-列是akey作为主键int,aname是varchar,

在``b''表中:-列将bkey设置为主键int,将akey(fkey)设置为int,将地址作为varchar(100),

在``c''表中:-列为ckey作为主键,bkey(fkey)int,城市为varchar(20)

在这里我想从表中删除数据,但无法删除bcoz,但出现以下错误:-

DELETE语句与REFERENCE约束冲突

为此,我想使用删除级联查询"可以帮助任何人使用示例

hi i have 3 tables (a table,b table,c table)

in ''a'' Table :- columns are akey as primarykey int, aname as varchar,

in ''b'' Table :- columns are bkey as primarykey int, akey(fkey) int , address as varchar(100),

in ''c'' Table :- columns are ckey as primarykey, bkey(fkey) int, city as varchar(20)

here i want to delte the data from a table, but not able to delete bcoz i''m getting below error:-

The DELETE statement conflicted with the REFERENCE constraint

for this i want to use "delete cascade query" can any one help to how use thie one with example

推荐答案

,您需要在"ON DELETE CASCADE"上指定创建表时的外键约束.您可以在google上查看并签出.

祝你好运!
You would need to specify "ON DELETE CASCADE" on the foreign key constraint when creating the table. You can check google on this and check it out.

Good luck!


这篇关于需要删除级联查询以一次从3个表中删除数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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