sql查询从存储过程中的多个表中删除数据 [英] sql query for delete data from multiple table in store procedure

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

问题描述

我有两张桌子:

1)个人资料:

prof_id

名称

地址
emailid

log_id



2)登录:

log_id

用户名

密码



当我从个人资料表中删除数据时,登录表中的数据也被删除。

什么是商店程序中的sql查询?????????



请帮助我........

i have two table:
1)profile:
prof_id
name
address
emailid
log_id

2)login:
log_id
username
password

when I delete data from profile table ,data in login table also deleted .
what is sql query in store procedure for that????????

please help me........

推荐答案

我认为商店程序没有参与这样的工作流程。

显然原因隐藏在这些表之间的关系中。

配置文件表是主要的,登录是依赖的。

每当你尝试从这个查询的帮助下删除配置文件表中的数据时:

从配置文件中删除name ='' testuser'';



登录表中与个人资料相关的所有数据也将被删除。
I think store procedure is not took a part in such workflow.
Obviously the reason is hidden in relationships between this tables.
Profile table is major , login is dependant.
Whenever you try to delete data from profile table with help of such query:
delete from profile where name=''testuser'';

all the data from login table which is related to profile will be deleted too.


看一看在这个类似的线程

如何通过传递单个变量从两个表中删除一行[ ^ ]
Take a look at this similar thread
how to delete a row from two table by passing single variable[^]


这篇关于sql查询从存储过程中的多个表中删除数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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