Codington
0 of 8 problems solved • 0%

Exercise prompt

Match Only Production Runs

The example keeps every service and matches only staging runs. The environment condition belongs in ON. Moving it into WHERE filters the finished result and removes the services without a matching run.

Example

SELECT s.name, d.id AS run_id FROM services AS s LEFT JOIN deployments AS d ON s.id = d.service_id AND d.environment = 'staging';

Your task

Build the same report for production. Show each service’s name and the deployment ID as run_id. Keep every production run and include one row with a NULL run ID for each service without a production run.

Opening the database…