Controll if exist a relation in a junction table

Hello,

in my project i’ve got two table related by a Junction Table (relation many to many)

{table A, table B} -> table a_b.

is there a method ,if I want to delete a record in the table a, to check if exist a relation in the table a_b?

Code side, you can search if related model table_a_b exists;

Database side, you can enfore integrity using foreign keys or triggers;