SQLSQL LabPostgreSQL practice
00:0010 / 45
J04IntermediateLEFT JOIN · conditional count

Incident linkage coverage

For every customer return customer_id, name, incident_count, and linked_incident_count. A linked incident has a non-NULL deployment_id. Sort by customer_id.

Data available

Use these tables

2 tables · 1 relationship
Table 1

customers

Organizations using the deployed platform.

  • customer_idintegerPK
  • nametext
  • industrytext
  • regiontext
  • tiertext
  • onboarded_attimestamptz
Table 2

incidents

Operational incidents; unresolved rows have no resolved_at.

  • incident_idintegerPK
  • customer_idintegerFK
  • deployment_idintegerNULLFK
  • severitytext
  • opened_attimestamptz
  • resolved_attimestamptzNULL
  • root_causetextNULL
How the tables connect
incidents.customer_id=customers.customer_id
Query editor

PostgreSQL

Run query
Result stream

Output

Run your query to inspect its result.
Contextual coach

Ask about this attempt

Run or check a query first. The coach only comments on a real error or grader mismatch.

Field notes

Hints & explanation

Try to solve it cold. Two progressive hints are available.