sql – A self join query


Given the below relational schema

people(pid, name, gender, age, email, city, state)

books(ISBN, title, edition, publisher, year, rating)

write(pid, ISBN)pid is a foreign key and it refers to people(pid),ISBN is a foreign key and it refers to books(ISBN)

I need to write a SQL query find the authors who either never published co-authored books or only co-authored with others from the same state, return their names.

I know I need to use a self join but not sure how to do that.

Thanks!