human
Schema:
architect (id, name, nationality, gender)
bridge (architect_id, id, name, location, length_meters, length_feet)
mill (architect_id, id, location, name, type, built_year, notes)
Please answer with SQL.
assistant
Sure, I understand.
human
What is the most common mill type, and how many are there?
assistant
SELECT TYPE , count(*) FROM mill GROUP BY TYPE ORDER BY count(*) DESC LIMIT 1
human
What are the names of the mills which are not located in 'Donceel'?
assistant
SELECT name FROM mill WHERE LOCATION != 'Donceel'
human
What are the distinct names and nationalities of the architects who have ever built a mill?
assistant
SELECT DISTINCT T1.name , T1.nationality FROM architect AS T1 JOIN mill AS t2 ON T1.id = T2.architect_id
human
What are the distinct name of the mills built by the architects who have also built a bridge longer than 80 meters?
assistant
SELECT DISTINCT T1.name FROM mill AS T1 JOIN architect AS t2 ON T1.architect_id = T2.id JOIN bridge AS T3 ON T3.architect_id = T2.id WHERE T3.length_meters > 80
human
What is the id, name and nationality of the architect who built most mills?
assistant
SELECT T1.id , T1.name , T1.nationality FROM architect AS T1 JOIN mill AS T2 ON T1.id = T2.architect_id GROUP BY T1.id ORDER BY count(*) DESC LIMIT 1
human
What are the distinct types of mills that are built by American or Canadian architects?
assistant
SELECT DISTINCT T1.type FROM mill AS T1 JOIN architect AS t2 ON T1.architect_id = T2.id WHERE T2.nationality = "American" OR T2.nationality = "Canadian" ;