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
Hello! Can you provide me with a list of all churches please? | Do you need their names or ids? | Ah yes! Can you please provide me with a list containing both?
assistant
SELECT Church_id , name FROM church;
human
Thank you for that! Could you filter that list to show only the church names and ids of churches that have hosted 2 or more weddings?
assistant
SELECT T1.name , T1.church_id FROM church AS T1 JOIN wedding AS T2 ON T1.church_id = T2.church_id GROUP BY T1.church_id HAVING COUNT( * ) > = 2 ;