select two tables and print the columns side by side with matching key in hive
SELECT 'table_1' AS table_1
    ,'table_2' AS table_2
    ,'id_1' AS table_1_pk
    ,'id_2' AS table_2_pk
    ,t1.id_1 table_1_pk_value
    ,t2.id_2 AS table_2_pk_value
    ,'name_1' AS table_1_col
    ,'name_2' AS table_2_col
    ,t1.name_1 AS table_1_value
    ,t2.name_2 AS table_2_value
    ,CASE 
        WHEN t1.name_1 = t2.name_2
            THEN '0'
        WHEN t1.name_1 &lt;&gt; t2.name_2
            THEN '1'
        END AS flag
FROM table_1 AS t1
FULL JOIN table_2 AS t2 ON t1.id_1 = t2.id_2;