human
Schema:
Services (Service_ID, Service_Type_Code)
Participants (Participant_ID, Participant_Type_Code, Participant_Details)
Events (Event_ID, Service_ID, Event_Details)
Participants_in_Events (Event_ID, Participant_ID)
Please answer with SQL.
assistant
Sure, I understand.
human
How many events are there?
assistant
SELECT COUNT( * ) FROM EVENTS;
human
List all the event ids.
assistant
SELECT event_id FROM Participants_in_Events;
human
Show all the event information if the event has someone participated.
assistant
SELECT * FROM EVENTS WHERE event_id IN ( SELECT event_id FROM Participants_in_Events );
human
How about nobody has participated?
assistant
SELECT * FROM EVENTS WHERE event_id NOT IN ( SELECT event_id FROM Participants_in_Events ) ;