How to remove related entities in one query?

Hello, I tried to remove the row from the table patr and the line with a reference key that refers to it
here is the table structure
Create table part(
 p_no integer primary key,
 p_name varchar(20) not null,
 price integer not null,
 color varchar(1) not null,
 weight integer not null
);
 create table cells(
 sno integer not null,
 pno integer not null,
 foreign key(sno) references supplier(sno),
 foreign key(pno) references part(p_no)
 );


and the query that didn't work
delete cells as c, as part of p from s, p where c.pno = (
select p.p_no from p where p.p_name = 'Bearing') and p.p_name = 'Bearing';


Please explain why the query didn't work and that it needs to be fix, thanks in advance
April 19th 20 at 12:12
0 answer

Find more questions by tags PostgreSQL