2. Steps followed:
First load data from local directory to hdfs storage using put operation i.e.
hdfs dfs –put titanic.txt internship/titanic.txt
Create an table i.e. create external table titanic1(userid int,survived int class
int,name string,sex string,age string,sibsp int,parch int,tkt string,fare
float,cabin string,embarked chararray) row format delimited fields
terminated by ",";
load data in hdfs directory into table i.e. load data inpath
"internship/titanic.txt" into table titanic1;
Your data is successfully added into table and ready for analysis
3. Q1. AVG AGE OF MALE WHO DIED IN THE INCIDENT?
Ans: 31.618
4. Q2. AVG AGE OF FEMALE WHO DIED IN THE INCIDENT?
Ans: 25.046
5.
6. Q3.Number of people survived as per travelling class?
Ans:Class1: 136
Class2 :87
Class3: 119