salesDF.registerTempTable("sales") # Need to create a temp table first
spark.sql("SHOW TABLES").show()
spark.sql("SELECT * FROM sales").show()
spark.sql("SELECT region, country, profit FROM sales WHERE profit > 0").show()
spark.sql("SELECT region, country, profit FROM sales WHERE country = 'United States'").show()
Global View
Global view can be accessed by other users across the cluster as well
products.createOrReplaceGlobalTempView("prod")
spark.sql("SELECT * FROM global_temp.gv_sales").show() # View global tables