api_definition表和api_scenario_reference_id表中reference_id有什么用

1、api_definition表和api_scenario_reference_id表中reference_id有什么用,请解释该字段的具体作用

2、以下是我们用到SQL查询接口的覆盖率,为什么要加条件:reference_id IS NOT NULL

select *
from api_definition def
WHERE project_id = ‘d66b48a1-8e69-4764-8a83-088bf9bb7ac5’
AND status != ‘Trash’
AND latest = 1
and
(
exists (
SELECT 1
from api_scenario_reference_id
WHERE api_scenario_id in (
SELECT id from api_scenario
WHERE status != ‘Trash’
AND project_id = ‘
)
AND reference_id IS NOT NULL and method is not null
and url = def.path
– and regexp_replace(url, ‘/${0,1}{[^/]+}/’, ‘/######/’) = regexp_replace(def.path, ‘/${0,1}{[^/]+}/’, ‘/######/’)
)
or
exists (
SELECT 1
from api_scenario_reference_id
WHERE api_scenario_id in (
SELECT id from api_scenario
WHERE status != ‘Trash’
AND project_id = '

)
AND reference_id IS NOT NULL and method is null and reference_id = def.id
)
);

谢谢解答,
1、这个reference_id如果多表查询,用reference_id如何进行多表关联,可以给个例子吗?
2、如果答复如果是case则为case id,这个case ID在那几个表用到。
我的原始需求是要自己写SQl统计API覆盖率。