human
Schema:
artist (Artist_ID, Name, Country, Year_Join, Age)
exhibition (Exhibition_ID, Year, Theme, Artist_ID, Ticket_Price)
exhibition_record (Exhibition_ID, Date, Attendance)
Please answer with SQL.
assistant
Sure, I understand.
human
Show theme and year for all exhibitions in an descending order of ticket price.
assistant
SELECT theme , YEAR FROM exhibition ORDER BY ticket_price DESC
human
Show theme and year for all exhibitions with ticket prices lower than 15.
assistant
SELECT theme , YEAR FROM exhibition WHERE ticket_price < 15
human
What is the theme and artist name for the exhibition with a ticket price higher than the average?
assistant
SELECT T1.theme , T2.name FROM exhibition AS T1 JOIN artist AS T2 ON T1.artist_id = T2.artist_id WHERE T1.ticket_price > (SELECT avg(ticket_price) FROM exhibition)
human
What is the theme, date, and attendance for the exhibition in year 2004?
assistant
SELECT T2.theme , T1.date , T1.attendance FROM exhibition_record AS T1 JOIN exhibition AS T2 ON T1.exhibition_id = T2.exhibition_id WHERE T2.year = 2004
human
How many exhibitions have a attendance more than 100 or have a ticket price below 10?
assistant
SELECT count(*) FROM exhibition_record AS T1 JOIN exhibition AS T2 ON T1.exhibition_id = T2.exhibition_id WHERE T1.attendance > 100 OR T2.ticket_price < 10
human
Which themes have had corresponding exhibitions that have had attendance both below 100 and above 500?
assistant
SELECT T2.theme FROM exhibition_record AS T1 JOIN exhibition AS T2 ON T1.exhibition_id = T2.exhibition_id WHERE T1.attendance < 100 INTERSECT SELECT T2.theme FROM exhibition_record AS T1 JOIN exhibition AS T2 ON T1.exhibition_id = T2.exhibition_id WHERE T1.attendance > 500 ;