RienSQL
TASK #130 · Medium · GlowByte

Number of contracts per company

Your brief
Given a database with information about companies and their contracts. The Company table stores company information, the Contract table stores contract information, the Company_contract table stores relations between companies and their contracts.

Show the number of contracts per each company, including companies without contracts (0 for them). The result should contain company name (company_name) and contract count (contract_count).
Expected columnscompany_name contract_countGlowByte
SQL editor
SQLite
Ctrl / ⌘ + ↵
Result

Write a query and run it to see the results.

Schema
Companycompany_id, company_name
Contractcontract_id, contract_number
Company_contractcompany_id, contract_id