mysql - Number of reference exist in another tables - PostgreSQL -


i have more 100 tables. user table 1 among them. user related multiple table. if i'm going delete user, need check user table reference exist in other tables. need number of foreign relation exists in other table. user additional stored in table. number of reference more 1, should not delete.

i'm working in postgresql. think it's possible in mysql. dont know postgresql i'm new postgresql.

thanks in advance.

when define foreign key can give option restrict delete if other table still holds key. here example postgres manual

create table order_items (     product_no integer references products on delete restrict,     order_id integer references orders on delete cascade,     quantity integer,     primary key (product_no, order_id) ); 

Comments

Popular posts from this blog

linux - xterm copying to CLIPBOARD using copy-selection causes automatic updating of CLIPBOARD upon mouse selection -

c++ - qgraphicsview horizontal scrolling always has a vertical delta -