How do you keep samples that have no label yet?
LEFT JOIN retains unmatched left rows and fills the missing right side with NULLs.
SQLite example and interpretation
Sample two remains on the worklist with a blank label. Multiple annotations on the right can still expand a sample into several rows.
WITH s(id) AS (VALUES(1),(2)), l(id,tag) AS (VALUES(1,'cat')) SELECT s.id,tag FROM s LEFT JOIN l ON s.id=l.id ORDER BY s.id;Result [[1, "cat"], [2, null]]
中文
怎样保留还没有标签的样本?
LEFT JOIN 为左侧没有匹配的行补上一组 NULL,适合从完整样本名册出发盘点覆盖。
SQLite 示例与适用条件
样本 2 尚无标签,仍应出现在待办表。若右表每个样本有多次标注,一条样本可能展开成多行。
WITH s(id) AS (VALUES(1),(2)), l(id,tag) AS (VALUES(1,'cat')) SELECT s.id,tag FROM s LEFT JOIN l ON s.id=l.id ORDER BY s.id;结果 [[1, "cat"], [2, null]]