human
Schema:
region (Region_ID, Region_name, Date, Label, Format, Catalogue)
party (Party_ID, Minister, Took_office, Left_office, Region_ID, Party_name)
member (Member_ID, Member_Name, Party_ID, In_office)
party_events (Event_ID, Event_Name, Party_ID, Member_in_charge_ID)
Please answer with SQL.
assistant
Sure, I understand.
human
show the party names and the number of events for party id 2
assistant
SELECT T2.party_name , COUNT( * ) FROM party_events AS T1 JOIN party AS T2 ON T1.party_id = T2.party_id WHERE T1.party_id = 2 GROUP BY T1.party_id;
human
find the count of the event name took place for the party id 1
assistant
SELECT T1.party_id , COUNT( T2.party_name ) FROM party_events AS T1 JOIN party AS T2 ON T1.party_id = T2.party_id WHERE T1.party_id = 1 ;