CREATE TABLE driverstandings (driverstandingsid NUMBER, raceid NUMBER, driverid NUMBER, points NUMBER, position NUMBER, positiontext CLOB, wins NUMBER)
CREATE TABLE results (resultid NUMBER, raceid NUMBER, driverid NUMBER, constructorid NUMBER, number NUMBER, grid NUMBER, position NUMBER, positiontext CLOB, positionorder NUMBER, points NUMBER, laps NUMBER, time CLOB, milliseconds NUMBER, fastestlap NUMBER, rank NUMBER, fastestlaptime CLOB, fastestlapspeed CLOB, statusid NUMBER)
CREATE TABLE pitstops (raceid NUMBER, driverid NUMBER, stop NUMBER, lap NUMBER, time CLOB, duration CLOB, milliseconds NUMBER)
CREATE TABLE constructorresults (constructorresultsid NUMBER, raceid NUMBER, constructorid NUMBER, points NUMBER, status NUMBER)
CREATE TABLE drivers (driverid NUMBER, driverref CLOB, number NUMBER, code CLOB, forename CLOB, surname CLOB, dob CLOB, nationality CLOB, url CLOB)
CREATE TABLE status (statusid NUMBER, status CLOB)
CREATE TABLE races (raceid NUMBER, year NUMBER, round NUMBER, circuitid NUMBER, name CLOB, date CLOB, time CLOB, url CLOB)
CREATE TABLE laptimes (raceid NUMBER, driverid NUMBER, lap NUMBER, position NUMBER, time CLOB, milliseconds NUMBER)
CREATE TABLE qualifying (qualifyid NUMBER, raceid NUMBER, driverid NUMBER, constructorid NUMBER, number NUMBER, position NUMBER, q1 CLOB, q2 CLOB, q3 CLOB)
CREATE TABLE constructors (constructorid NUMBER, constructorref CLOB, name CLOB, nationality CLOB, url CLOB)
CREATE TABLE circuits (circuitid NUMBER, circuitref CLOB, name CLOB, location CLOB, country CLOB, lat NUMBER, lng NUMBER, alt NUMBER, url CLOB)
CREATE TABLE constructorstandings (constructorstandingsid NUMBER, raceid NUMBER, constructorid NUMBER, points NUMBER, position NUMBER, positiontext CLOB, wins NUMBER)
CREATE TABLE seasons (year NUMBER, url CLOB)

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