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
Show the names of journalists and the dates of the events they reported.
assistant
SELECT T3.Name , T2.Date 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
What are the nationalities and ages of journalists?
assistant
SELECT Nationality , Age FROM journalist
human
Show the names of journalists and the number of events they reported.
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
human
What is the nationality of the journalist with the largest number of years working?
assistant
SELECT Nationality FROM journalist ORDER BY Years_working DESC LIMIT 1
human
Show the names of journalists and the names of the events they reported in ascending order
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 ORDER BY T2.Event_Attendance ASC
human
List the names of journalists in ascending order of years working.
assistant
SELECT Name FROM journalist ORDER BY Years_working ASC ;