CREATE TABLE person (name TEXT, age DECIMAL, city TEXT, gender TEXT, job TEXT)
CREATE TABLE personfriend (name TEXT, friend TEXT, year DECIMAL)

What are the names of the people who are older 40 but no friends under age 30?
SELECT T1.name FROM person AS T1 JOIN personfriend AS T2 ON T1.name = T2.name WHERE T2.friend IN (SELECT name FROM person WHERE age > 40) EXCEPT SELECT T1.name FROM person AS T1 JOIN personfriend AS T2 ON T1.name = T2.name WHERE T2.friend IN (SELECT name FROM person WHERE age < 30)
SELECT "T1"."name" FROM "person" AS "T1" JOIN "personfriend" AS "T2" ON "T1"."name" = "T2"."name" AND "T2"."friend" IN (SELECT "name" FROM "person" WHERE "age" > 40) EXCEPT SELECT "T1"."name" FROM "person" AS "T1" JOIN "personfriend" AS "T2" ON "T1"."name" = "T2"."name" AND "T2"."friend" IN (SELECT "name" FROM "person" WHERE "age" < 30)