Question: How many assets does each maintenance contract contain? List the number and the contract id.
Schema: create table assets (maintenance_contract_id varchar, PRIMARY KEY (maintenance_contract_id)); create table maintenance_contracts (maintenance_contract_id varchar, PRIMARY KEY (maintenance_contract_id))
SQL: select count(*), t1.maintenance_contract_id from maintenance_contracts as t1 join assets as t2 on t1.maintenance_contract_id = t2.maintenance_contract_id group by t1.maintenance_contract_id