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
What are the nationalities and ages of journalists?
assistant
SELECT Nationality , Age FROM journalist
human
Find the average age and experience working length of journalists working on different role type.
assistant
SELECT avg(t1.age) , avg(Years_working) , t2.work_type FROM journalist AS t1 JOIN news_report AS t2 ON t1.journalist_id = t2.journalist_id GROUP BY t2.work_type
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 different nationalities and the number of journalists of each nationality.
assistant
SELECT Nationality , COUNT(*) FROM journalist GROUP BY Nationality
human
List the names of journalists in ascending order of years working.
assistant
SELECT Name FROM journalist ORDER BY Years_working ASC
human
Show the nations that have both journalists with more than 10 years of working and journalists with less than 3 years of working.
assistant
SELECT Nationality FROM journalist WHERE Years_working > 10 INTERSECT SELECT Nationality FROM journalist WHERE Years_working < 3 ;