How do you use WHERE
keyword to get the count of gender and their percentage, who survived in titanic disaster?
my code:
spark.sql(
"SELECT Sex Where Survived=1 ,count(Sex) \
as gender_count,count(sex)*100/sum(count(sex)) over() \
as percent from titanic_table GROUP BY sex"
).show()
error:
ParseException: " mismatched input ',' expecting <EOF>(line 1, pos 28) == SQL == SELECT Sex Where Survived=1 ,count(Sex) as gender_count,count(sex)*100/sum(count(sex)) over() as percent from titanic_table GROUP BY sex ----------------------------^^^ "