human
Schema:
Person (name, age, city, gender, job)
PersonFriend (name, friend, year)
Please answer with SQL.
assistant
Sure, I understand.
human
is there any person who has no student friends
assistant
SELECT * FROM person EXCEPT SELECT * FROM Person AS T1 JOIN PersonFriend AS T2 ON T1.name = T2.friend WHERE T1.job = 'student';
human
is there any person friend for this persons
assistant
SELECT name FROM person EXCEPT SELECT T2.name FROM Person AS T1 JOIN PersonFriend AS T2 ON T1.name = T2.friend WHERE T1.job = 'student' INTERSECT SELECT T3.name FROM Person AS T4 JOIN PersonFriend AS T3 ON T4.name = T3.friend;
human
ok, list the name of the person who has no student friend in ascending order
assistant
SELECT name FROM person EXCEPT SELECT T2.name FROM Person AS T1 JOIN PersonFriend AS T2 ON T1.name = T2.friend ORDER by name desc ;