human
Schema:
Manufacturers (Code, Name, Headquarter, Founder, Revenue)
Products (Code, Name, Price, Manufacturer)
Please answer with SQL.
assistant
Sure, I understand.
human
Find the name and revenue of the company that earns the highest revenue in each city.
assistant
SELECT name , max(revenue) , Headquarter FROM manufacturers GROUP BY Headquarter
human
Where is the headquarter of the company founded by James?
assistant
SELECT headquarter FROM manufacturers WHERE founder = 'James'
human
What are the average, maximum and total revenues of all companies?
assistant
SELECT avg(revenue) , max(revenue) , sum(revenue) FROM manufacturers
human
Find the total revenue of companies of each founder.
assistant
SELECT sum(revenue) , founder FROM manufacturers GROUP BY founder
human
Find all manufacturers' names and their headquarters, sorted by the ones with highest revenue first.
assistant
SELECT name , headquarter FROM manufacturers ORDER BY revenue DESC
human
What are the names, headquarters and founders of the company with the highest revenue?
assistant
SELECT name , headquarter , founder FROM manufacturers ORDER BY revenue DESC LIMIT 1 ;