在postgresql中使用数组删除多条记录

在postgresql中使用数组删除多条记录,postgresql,Postgresql,我需要一个通过在参数中传递数组值集来删除多个表中多行的过程 考虑3个表: student_master(id,student_name); subject_master(id,subject_name); marks(id,student_id,student_id,subject_id,marks) 这里是参数 例如,学生id为:a['1','3','7','15'] 该标准的程序是什么 如果您的student\u ids是整数或bigint,则使用不带引号的: delete from ma

我需要一个通过在参数中传递数组值集来删除多个表中多行的过程

考虑3个表:

student_master(id,student_name);
subject_master(id,subject_name);
marks(id,student_id,student_id,subject_id,marks)
这里是参数 例如,学生id为:a['1','3','7','15']


该标准的程序是什么

如果您的
student\u id
s是整数或bigint,则使用不带引号的:

delete from marks
where student_id = ANY(Array [1,3,7,15])
returning student_id

要从哪些表中删除行?这些值与哪些ID相关?为什么要以字符串形式传递数字?通过传递学生id,我想删除与该学生id相关的所有数据。从其他表(主题和分数)中,我只需要传递数组中的id。是否使用?如果是的话,你是怎么做的<关于删除级联的code>可以在您的情况下帮助您很多。@pozs&a_horse感谢您的解决方案