human
Schema:
entrepreneur (Entrepreneur_ID, People_ID, Company, Money_Requested, Investor)
people (People_ID, Name, Height, Weight, Date_of_Birth)
Please answer with SQL.
assistant
Sure, I understand.
human
Hello! Can you show me a list of all investor names?
assistant
SELECT distinct Investor FROM entrepreneur;
human
Can you filter this list to include only the investors that were associated with more than one entrepreneur id?
assistant
SELECT Investor FROM entrepreneur GROUP by investor having COUNT( * ) > 1;
human
Can you filter this list to show only the rows associated with money requested that are not between 120000 and 140000?
assistant
SELECT investor FROM entrepreneur WHERE investor IN ( SELECT Investor FROM entrepreneur WHERE Money_Requested > 140000 INTERSECT SELECT Investor FROM entrepreneur WHERE Money_Requested < 120000 ) GROUP by investor having COUNT( * ) > 1 ;