Dataframe creation commands:

Now we will register them as tempTables and will do sparksql:

For loading file in comma delimited csv to a dataframe, please refer to the below command:
val df1 = sqlContext.read.format("csv").option("header", "true").option("delimiter", ",").option("inferschema", "false").load("stud.csv");