human
Schema:
event (Event_ID, Date, Venue, Name, Event_Attendance)
journalist (journalist_ID, Name, Nationality, Age, Years_working)
news_report (journalist_ID, Event_ID, Work_Type)
Please answer with SQL.
assistant
Sure, I understand.
human
Shoe me the names of all the journalists.
assistant
SELECT name FROM journalist;
human
Now include the names of all the events they each worked on.
assistant
SELECT T3.Name , T2.name FROM news_report AS T1 JOIN event AS T2 ON T1.Event_ID = T2.Event_ID JOIN journalist AS T3 ON T1.journalist_ID = T3.journalist_ID;
human
How many did they each do?
assistant
SELECT T3.Name , COUNT( * ) FROM news_report AS T1 JOIN event AS T2 ON T1.Event_ID = T2.Event_ID JOIN journalist AS T3 ON T1.journalist_ID = T3.journalist_ID GROUP BY T3.Name ;