What is the average weeks of a song with a larger than 3 position after 1977?
CREATE TABLE table_name_40 (weeks_on_chart INTEGER, position VARCHAR, year VARCHAR)
SELECT AVG(weeks_on_chart) FROM table_name_40 WHERE position > 3 AND year > 1977
<s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE table_name_40 (weeks_on_chart INTEGER, position VARCHAR, year VARCHAR) Question: What is the average weeks of a song with a larger than 3 position after 1977? [/INST] SELECT AVG(weeks_on_chart) FROM table_name_40 WHERE position > 3 AND year > 1977 </s>