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
List the companies of entrepreneurs in descending order of money requested.
assistant
SELECT Company FROM entrepreneur ORDER BY Money_Requested DESC
human
Show the investors shared by entrepreneurs that requested more than 140000 and entrepreneurs that requested less than 120000.
assistant
SELECT Investor FROM entrepreneur WHERE Money_Requested > 140000 INTERSECT SELECT Investor FROM entrepreneur WHERE Money_Requested < 120000
human
What are the investors that have invested in at least two entrepreneurs?
assistant
SELECT Investor FROM entrepreneur GROUP BY Investor HAVING COUNT(*) >= 2
human
List the companies and the investors of entrepreneurs.
assistant
SELECT Company , Investor FROM entrepreneur
human
What are the investors of entrepreneurs and the corresponding number of entrepreneurs invested by each investor?
assistant
SELECT Investor , COUNT(*) FROM entrepreneur GROUP BY Investor
human
Return the investor who have invested in the greatest number of entrepreneurs.
assistant
SELECT Investor FROM entrepreneur GROUP BY Investor ORDER BY COUNT( * ) DESC LIMIT 1 ;