-- Language PostgreSQL
        -- Tables: 
             -- Table: circuits 
columns : [['circuit id', 'number'], ['circuit reference', 'text'], ['name', 'text'], ['location', 'text'], ['country', 'text'], ['latitude', 'number'], ['longitude', 'number'], ['altitude', 'number'], ['url', 'text']]

 -- Table: races 
columns : [['race id', 'number'], ['year', 'number'], ['round', 'number'], ['circuit id', 'number'], ['name', 'text'], ['date', 'text'], ['time', 'text'], ['url', 'text']]

 -- Table: drivers 
columns : [['driver id', 'number'], ['driver reference', 'text'], ['number', 'number'], ['code', 'text'], ['forename', 'text'], ['surname', 'text'], ['dob', 'text'], ['nationality', 'text'], ['url', 'text']]

 -- Table: status 
columns : [['status id', 'number'], ['status', 'text']]

 -- Table: seasons 
columns : [['year', 'number'], ['url', 'text']]

 -- Table: constructors 
columns : [['constructor id', 'number'], ['constructor reference', 'text'], ['name', 'text'], ['nationality', 'text'], ['url', 'text']]

 -- Table: constructor standings 
columns : [['constructor standings id', 'number'], ['race id', 'number'], ['constructor id', 'number'], ['points', 'number'], ['position', 'number'], ['position text', 'text'], ['wins', 'number']]

 -- Table: results 
columns : [['result id', 'number'], ['race id', 'number'], ['driver id', 'number'], ['constructor id', 'number'], ['number', 'number'], ['grid', 'number'], ['position', 'number'], ['position text', 'text'], ['position order', 'number'], ['points', 'number'], ['laps', 'number'], ['time', 'text'], ['milliseconds', 'number'], ['fastest lap', 'number'], ['rank', 'number'], ['fastest lap time', 'text'], ['fastest lap speed', 'text'], ['status id', 'number']]

 -- Table: driver standings 
columns : [['driver standings id', 'number'], ['race id', 'number'], ['driver id', 'number'], ['points', 'number'], ['position', 'number'], ['position text', 'text'], ['wins', 'number']]

 -- Table: constructor results 
columns : [['constructor results id', 'number'], ['race id', 'number'], ['constructor id', 'number'], ['points', 'number'], ['status', 'number']]

 -- Table: qualifying 
columns : [['qualify id', 'number'], ['race id', 'number'], ['driver id', 'number'], ['constructor id', 'number'], ['number', 'number'], ['position', 'number'], ['q1', 'text'], ['q2', 'text'], ['q3', 'text']]

 -- Table: pit stops 
columns : [['race id', 'number'], ['driver id', 'number'], ['stop', 'number'], ['lap', 'number'], ['time', 'text'], ['duration', 'text'], ['milliseconds', 'number']]

 -- Table: lap times 
columns : [['race id', 'number'], ['driver id', 'number'], ['lap', 'number'], ['position', 'number'], ['time', 'text'], ['milliseconds', 'number']]

You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. 
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.



Question: What are the names of races that were held after 2017 and the circuits were in the country of Spain?
SQL: SELECT T1.name FROM races AS T1 JOIN circuits AS T2 ON T1.circuitid = T2.circuitid WHERE T2.country = "Spain" AND T1.year > 2017