I have a table user (id, name ...) and user_emails (id, user_id, email_id, type). There was no foreign key enforcement between these tables initially. I would like to know all rows in user_emails which don’t have a corresponding user_id in the user table.
I have a table user (id, name …) and user_emails (id, user_id, email_id, type)
Share
select * from user_emails where user_id not in (select id from user)this would probably give you the answer.