← All projects
Case study · SQL

What do 30,000 home insurance contracts reveal?

A SQLite database of 30,335 home insurance contracts, then twelve business questions in SQL: where the customers live, what they insure and how much they pay.

Client
Home insurance company (OpenClassrooms case)
Role
Data Analyst, training project
Year
2025
Stack
  • SQL
  • SQLite

The question

A home insurance company kept its contracts in two flat files: one row per contract, and a reference list of French communes. It wanted them in a relational database its teams could query, and answers to twelve business questions: where its customers live, what they insure, and how much they pay.

This was my first SQL project: design the database, load the two files into it, then answer the twelve questions.

  • 30,335home insurance contracts
  • 12business questions answered in SQL
  • 47%of the contracts in Île-de-France
  • €19.33average monthly premium

Building the database

I started with a data dictionary listing each field with its type, size and role, then designed two tables linked by a foreign key: every contract points to the commune where the insured home is located, and the commune table holds its department and region. This avoids repeating the same geographic information on 30,335 rows.

The relational schema
Two tables: contrat, with ten columns and a foreign key Code_dep_code_commune, points to region, whose primary key is Code_dep_code_commune; many contracts link to one commune.

Column names are kept in French, as in the source files.

On the GDPR side, the contract table held the street address of every insured home. Combined with a commune, a surface and a premium, an address can point to a person, so the public version of the database leaves the four address columns out.

Who the customers are

The portfolio is mostly made of apartments (92%) and main homes (84%), and 70% of the policyholders own their home. In Paris, the average surface of insured homes is 51.8 m², and the five largest surfaces in the portfolio range from 559 to 815 m². Geographically, the portfolio leans heavily towards the Paris region.

Contracts by region (top 6)
  • Île-de-France14,177
  • Provence-Alpes-Côte d’Azur3,279
  • Auvergne-Rhône-Alpes3,042
  • Nouvelle-Aquitaine2,038
  • Occitanie1,609
  • Pays de la Loire1,196

Île-de-France alone holds 47% of the contracts. Paris’s arrondissements fill most of the communes with at least 150 contracts.

The premiums

The average monthly premium is €19.33. By department, Paris comes clearly first, at €36.40 a month, almost twice the average, ahead of Hauts-de-Seine (€26.27) and Val-de-Marne (€19.82). For this ranking, a join links each contract to its commune, and so to its department:

-- Top 10 departments by average monthly premium
SELECT region.dep_nom,
       ROUND(AVG(contrat.Prix_cotisation_mensuel), 2) AS average_premium,
       COUNT(*)                                       AS contracts
FROM contrat
JOIN region
    ON contrat.Code_dep_code_commune = region.Code_dep_code_commune
GROUP BY region.dep_nom
ORDER BY average_premium DESC
LIMIT 10;

The declared value of the contents paints a mostly modest portfolio: three quarters of the contracts declare less than €25,000 of contents.

Contracts by declared value of the contents
  • €0–25,00022,720
  • €25–50,0006,815
  • €50–100,000696
  • €100,000+104

Limits

  • A single snapshot: the data has no dates, so it says nothing about how the portfolio or the prices evolve.
  • Declared values come in bands, not amounts, which limits how fine the analysis can be.

What I learned

This was my first SQL project. It taught me to turn a business question into a query: each question meant choosing the right table, the right filter and the right level of grouping, from a simple count of main homes to the join between contracts and communes that ranks the departments. I also saw why a normalised schema matters: the geographic information is stored only once, and a single join is enough to find it for any contract.