What is the highest total number of medals for a team ranked smaller than 1 and had 20 gold medals?
CREATE TABLE table_name_40 (total INTEGER, gold VARCHAR, rank VARCHAR)
SELECT MAX(total) FROM table_name_40 WHERE gold = 20 AND rank < 1
<s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE table_name_40 (total INTEGER, gold VARCHAR, rank VARCHAR) Question: What is the highest total number of medals for a team ranked smaller than 1 and had 20 gold medals? [/INST] SELECT MAX(total) FROM table_name_40 WHERE gold = 20 AND rank < 1 </s>