UPDATE SUBJEKTY
SET
    ULICE_CP = CASE
        -- tvar "... 74/11"
        WHEN ULICE_NAZEV REGEXP ' [0-9]+/[0-9]+$' THEN
            SUBSTRING_INDEX(SUBSTRING_INDEX(ULICE_NAZEV, ' ', -1), '/', 1)
        -- tvar "... 2099"
        WHEN ULICE_NAZEV REGEXP ' [0-9]+$' THEN
            SUBSTRING_INDEX(ULICE_NAZEV, ' ', -1)
        ELSE NULL
    END,

    ULICE_CO = CASE
        WHEN ULICE_NAZEV REGEXP ' [0-9]+/[0-9]+$' THEN
            SUBSTRING_INDEX(SUBSTRING_INDEX(ULICE_NAZEV, ' ', -1), '/', -1)
        ELSE NULL
    END,

    ULICE_NAZEV = CASE
        WHEN ULICE_NAZEV REGEXP ' [0-9]+/[0-9]+$' THEN
            TRIM(SUBSTRING(
                ULICE_NAZEV,
                1,
                CHAR_LENGTH(ULICE_NAZEV)
                  - CHAR_LENGTH(SUBSTRING_INDEX(ULICE_NAZEV, ' ', -1))
                  - 1
            ))
        WHEN ULICE_NAZEV REGEXP ' [0-9]+$' THEN
            TRIM(SUBSTRING(
                ULICE_NAZEV,
                1,
                CHAR_LENGTH(ULICE_NAZEV)
                  - CHAR_LENGTH(SUBSTRING_INDEX(ULICE_NAZEV, ' ', -1))
                  - 1
            ))
        ELSE ULICE_NAZEV
    END;
