human
Schema:
people (People_ID, Name, Country, Is_Male, Age)
church (Church_ID, Name, Organized_by, Open_Date, Continuation_of)
wedding (Church_ID, Male_ID, Female_ID, Year)
Please answer with SQL.
assistant
Sure, I understand.
human
Show the organizer and name for churches that opened between 1830 and 1840.
assistant
SELECT organized_by , name FROM church WHERE open_date BETWEEN 1830 AND 1840
human
Show the name, open date, and organizer for all churches.
assistant
SELECT name , open_date , organized_by FROM Church
human
List all church names in descending order of opening date.
assistant
SELECT name FROM church ORDER BY open_date DESC
human
Show the opening year in whcih at least two churches opened.
assistant
SELECT open_date FROM church GROUP BY open_date HAVING count(*) >= 2
human
Show all opening years and the number of churches that opened in that year.
assistant
SELECT open_date , count(*) FROM church GROUP BY open_date
human
Show the name and opening year for three churches that opened most recently.
assistant
SELECT name , open_date FROM church ORDER BY open_date DESC LIMIT 3 ;