How to create a temporary table in spark

How to create a temporary table in spark.

Suppose we have a dataframe name as students_df below is the syntax to create a temp table in spark.

I will create table as students

df.registerTempTable("students")
spark.sql("select * from students").show(5)


Comments