##Instruction:
Database: formula_1
Total Tables: 13
Total Columns: 94

Table Schemas:

Database: formula_1
Total Tables: 13
Total Columns: 94

Table Schemas:

Table: circuits (9 columns)
---------------------------
• circuitId (integer): unique identification number of the circuit
• circuitRef (text): circuit reference name
• name (text): full name of circuit
• location (text): location of circuit
• country (text): country of circuit
• lat (real): latitude of location of circuit
• lng (real): longitude of location of circuit
  Values: commonsense evidence: 
Location coordinates: (lat, lng)
• alt (integer)
  Values: not useful
• url (text): url

Table: constructorResults (5 columns)
-------------------------------------
• constructorResultsId (integer): constructor Results Id
• raceId (integer): race id
• constructorId (integer): constructor id
• points (real): points
• status (text): status

Table: constructorStandings (7 columns)
---------------------------------------
• constructorStandingsId (integer): unique identification of the constructor standing records
• raceId (integer): id number identifying which races
• constructorId (integer): id number identifying which id
• points: how many points acquired in each race
• position (integer): position or track of circuits
• positionText (text)
  Values: same with position, not quite useful
• wins (integer): wins

Table: constructors (5 columns)
-------------------------------
• constructorId (integer): the unique identification number identifying constructors
• constructorRef (text): Constructor Reference name
• name (text): full name of the constructor
• nationality (text): nationality of the constructor
• url (text): the introduction website of the constructor
  Values: commonsense evidence: How to find out the detailed introduction of the constructor: through its url

Table: driverStandings (7 columns)
----------------------------------
• driverStandingsId (integer): the unique identification number identifying driver standing records
• raceId (integer): id number identifying which races
• driverId (integer): id number identifying which drivers
• points (real): how many points acquired in each race
• position (integer): position or track of circuits
• wins (integer): wins
• positionText (text)
  Values: same with position, not quite useful

Table: drivers (9 columns)
--------------------------
• driverId (integer): the unique identification number identifying each driver
• driverRef (text): driver reference name
• number (integer): number
• code (text): abbreviated code for drivers
  Values: if "null" or empty, it means it doesn't have code
• forename (text): forename
• surname (text): surname
• dob (date): date of birth
• nationality (text): nationality of drivers
• url (text): the introduction website of the drivers

Table: lapTimes (6 columns)
---------------------------
• raceId (integer): the identification number identifying race
• driverId (integer): the identification number identifying each driver
• lap (integer): lap number
• position (integer): position or track of circuits
• time (text): lap time
  Values: in minutes / seconds / ...
• milliseconds (integer): milliseconds

Table: pitStops (7 columns)
---------------------------
• raceId (integer): the identification number identifying race
• driverId (integer): the identification number identifying each driver
• stop (integer): stop number
• lap (integer): lap number
• time (text): time
  Values: exact time
• duration (text): duration time
  Values: seconds/
• milliseconds (integer): milliseconds

Table: qualifying (9 columns)
-----------------------------
• qualifyId (integer): the unique identification number identifying qualifying
  Values: How does F1 Sprint qualifying work? Sprint qualifying is essentially a short-form Grand Prix  a rac...
• raceId (integer): the identification number identifying each race
• driverId (integer): the identification number identifying each driver
• constructorId (integer): constructor Id
• number (integer): number
• position (integer): position or track of circuit
• q1 (text): time in qualifying 1
  Values: in minutes / seconds / ... 
commonsense evidence: 
Q1 lap times determine pole position and the orde...
• q2 (text): time in qualifying 2
  Values: in minutes / seconds / ... 
commonsense evidence: 
only top 15 in the q1 has the record of q2 
Q2 is...
• q3 (text): time in qualifying 3
  Values: in minutes / seconds / ... 
commonsense evidence: 
only top 10 in the q2 has the record of q3

Table: races (8 columns)
------------------------
• raceId (integer): the unique identification number identifying the race
• year (integer): year
• round (integer): round
• circuitId (integer): circuit Id
• name (text): name of the race
• date (date): duration time
• time (text): time of the location
• url (text): introduction of races

Table: results (18 columns)
---------------------------
• resultId (integer): the unique identification number identifying race result
• raceId (integer): the identification number identifying the race
• driverId (integer): the identification number identifying the driver
• constructorId (integer): the identification number identifying which constructors
• number (integer): number
• grid (integer): the number identifying the area where cars are set into a grid formation in order to start the race.
• position (integer): The finishing position or track of circuits
• positionText (text)
  Values: not quite useful
• positionOrder (integer): the finishing order of positions
• points (real): points
• laps (integer): lap number
• time (text): finish time
  Values: commonsense evidence: 
1. if the value exists, it means the driver finished the race. 
2. Only the t...
• milliseconds (integer): the actual finishing time of drivers in milliseconds
  Values: the actual finishing time of drivers
• fastestLap (integer): fastest lap number
• rank (integer): starting rank positioned by fastest lap speed
• fastestLapTime (text): fastest Lap Time
  Values: faster (smaller in the value) "fastestLapTime" leads to higher rank (smaller is higher rank)
• fastestLapSpeed (text): fastest Lap Speed
  Values: (km / h)
• statusId (integer): status ID
  Values: its category description appear in the table status

Table: seasons (2 columns)
--------------------------
• year (integer): the unique identification number identifying the race
• url (text): website link of season race introduction

Table: status (2 columns)
-------------------------
• statusId (integer): the unique identification number identifying status
• status (text): full name of status

##Evidence:
Spanish Grand Prix is the name of race refers to name = 'Spanish Grand Prix'; average fastest lap speed refers to avg(fastestLapSpeed);

##Role Access Policy (Column-Level):
Role: RaceAnalyst
Accessible Columns: circuits: circuitId, name, location, country, lat, lng; constructors: constructorId, name, nationality; drivers: driverId, driverRef, number, code, forename, surname, nationality; races: raceId, year, round, circuitId, name, date; lapTimes: raceId, driverId, lap, position, time, milliseconds; pitStops: raceId, driverId, stop, lap, time, duration, milliseconds; qualifying: qualifyId, raceId, driverId, constructorId, number, position, q1, q2, q3; results: resultId, raceId, driverId, constructorId, number, grid, position, positionOrder, points, laps, time, milliseconds, fastestLap, rank, fastestLapTime, fastestLapSpeed, statusId

Based on the above schema and your role's column-level access policy, generate a SQL query to answer the question. If your role does not have access to the required columns, respond with: "Sorry, I cannot answer."


Question: What is the average of fastest lap speed in the 2009 Spanish Grand Prix race?
Evidence: Spanish Grand Prix is the name of race refers to name = 'Spanish Grand Prix'; average fastest lap speed refers to avg(fastestLapSpeed);
Answer: SELECT AVG(T1.fastestLapSpeed) FROM results AS T1 INNER JOIN races AS T2 on T1.raceId = T2.raceId WHERE T2.year = 2009 AND T2.name = 'Spanish Grand Prix'
Permission: allowed (All required columns are permitted)
Gold SQL: SELECT AVG(T1.fastestLapSpeed) FROM results AS T1 INNER JOIN races AS T2 on T1.raceId = T2.raceId WHERE T2.year = 2009 AND T2.name = 'Spanish Grand Prix'