How can I do the opposite:
In other words, select all people whose last name is not Hansen or Pettersen.
WHERE lastname NOT IN ('Hansen', 'Pettersen')
see the section "IN and NOT IN statements " in SQL as SQLite understands
SELECT * FROM Persons WHERE LastName NOT IN ('Hansen','Pettersen')
You can undo IN with NOT :
IN
NOT
SELECT * FROM Persons WHERE LastName NOT IN ('hansen', 'Pettersen')
Just NOT IN :
NOT IN
SELECT * FROM Persons Where LastName NOT IN (...)
Cancel the condition with NOT.
select * from persons where NOT (LastName IN ('Hansen','Pettersen'));