select id,name from account where Id not in(select accountid from contact)
Here is what the above code is Doing:
1. We are selecting the id and name from the account table.
2. We are filtering the results to only show accounts that are not in the contact table.