CREATE TABLE ma_cmdm.ma_feature_pipe (
    Cust_inn VARCHAR(12) NOT NULL,    -- Customer INN
    Feature_nm VARCHAR(50) NOT NULL,  -- Name of feature
    Param_chr_3 VARCHAR(9) NOT NULL   -- Bank BIC
);

CREATE TABLE ma_cmdm.unified_customer (
    INN VARCHAR(12) NOT NULL,                    -- Customer INN
    CRM_COLABORATE_TYPE_NM VARCHAR(50) NULL,     -- The indication of a client/non-customer of the bank 'Сбербанк'
);

Write SQL-query:
- Performs a join operation between the two tables on the common Customer INN field.
- Selects only those rows where the Bank BIC equals '044525700' and the Name of feature is 'ACTIVE_IN_KB'.
- For each unique Customer, it outputs a value of 1 if CRM_COLABORATE_TYPE_NM is 1 and not Null, and 0 if they are not.

SQL-query: