-- 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: For each id of a driver who participated in at most 30 races, how many races did they participate in?
SQL: SELECT T1.driverid ,  count(*) FROM drivers AS T1 JOIN results AS T2 ON T1.driverid = T2.driverid JOIN races AS T3 ON T2.raceid = T3.raceid GROUP BY T1.driverid HAVING count(*)  <=  30