Amazon Interview Question

telephonic with technical and SQL coding ) 1 hr Difference b/w SQL and HDFS How do you read, map and reduce and text file in spark ETL How do you create tables in Hive Group by and union with Customer tables Size of data in Hadoop cluster Data warehousing Primarily focused for 45 min on Hive, Spark, Hadoop, HDFS, data warehousing and ETL And, no status on the interview yet, but even though I answered all the questions but, I failed in one coding question of 2 so, I don’t have any hopes for next rounds. It may be useful for you all. Here is the question I got on Amazon Interview Input: SALES_MONTH | PRODUCT_ID |SALE_AMOUNT JAN - 2020 |P1 | 100 FEB - 2020 |P2 | 200 JAN - 2020 |P3 | 500 MARCH - 2020 |P4 | 10 OUTPUT SALES_MONTH | P1_TOTAL |P2_TOTAL JAN - 2020 |100 | 0 FEB - 2020 |0 | 200 MARCH - 2020 |10 | 0

Interview Answer

Anonymous

Feb 23, 2021

select sales_month, p1_total, p2_total from (select sales_month, product_id, sales_amount from table) as source table PIVOT (sum(sales_amount) from Product_id in (P1,P2) ) AS PIVOT TABLE

2