Skip to content

BIOG_MAIN 中已有 c_index_year_type_code,無需在 c_notes 中重複 index year 生成理由 #21

@frankslin

Description

@frankslin

BIOG_MAIN.c_note 中有大量 c_notes 欄位僅包含「Index year algorithmically generated: Rule %」這樣的內容。由於已經有了 c_index_year_type_code,我們可以把這樣的片段去掉。

據統計,約 12.2 萬筆 c_notes 可直接清理掉,變成 NULL;1.77 筆 c_notes 包含其他内容,可將這一片段刪除。

下列為幾個有用的查詢。

1. 所有包含 Index year ... 的記錄(基本)

SELECT
c_personid,
c_notes
FROM BIOG_MAIN
WHERE c_notes IS NOT NULL
AND c_notes LIKE '%Index year algorithmically generated: Rule %'
ORDER BY c_personid;

2. 开头為 Index year ... 的記錄(大多數)

SELECT
c_personid,
c_notes
FROM BIOG_MAIN
WHERE c_notes IS NOT NULL
AND c_notes LIKE 'Index year algorithmically generated: Rule %'
ORDER BY c_personid;

3. 只看“嵌在中间/结尾”的少數記錄

SELECT
c_personid,
c_notes
FROM BIOG_MAIN
WHERE c_notes IS NOT NULL
AND c_notes LIKE '%Index year algorithmically generated: Rule %'
AND c_notes NOT LIKE 'Index year algorithmically generated: Rule %'
ORDER BY c_personid;

4. 只輸出「純 index year 說明」的記錄

SELECT
c_personid,
c_notes
FROM BIOG_MAIN
WHERE c_notes IS NOT NULL
AND c_notes LIKE 'Index year algorithmically generated: Rule %'
AND LENGTH(c_notes) BETWEEN 44 AND 49
ORDER BY c_personid;

5. 輸出“包含 index year 說明 + 其他內容”的記錄(用於人工檢查)

SELECT
c_personid,
c_notes
FROM BIOG_MAIN
WHERE c_notes IS NOT NULL
AND c_notes LIKE '%Index year algorithmically generated: Rule %'
AND NOT (
c_notes LIKE 'Index year algorithmically generated: Rule %'
AND LENGTH(c_notes) BETWEEN 44 AND 49
)
ORDER BY c_personid;

6. 預覽

SELECT
c_personid,
LEFT(c_notes, 300) AS note_preview
FROM BIOG_MAIN
WHERE c_notes IS NOT NULL
AND c_notes LIKE '%Index year algorithmically generated: Rule %'
ORDER BY c_personid
LIMIT 200;

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions