LEFT JOIN
between the Queries
table and the NPV
table on the id
and year
columns.COALESCE
function to replace any NULL
values in the npv
column with 0
.id
, year
, and the result of the COALESCE
function as the npv
in the final result set.erDiagram NPV { int id int year int npv id year {label:"PK"} } Queries { int id int year id year {label:"PK"} }