Hi @Vinodh247 ,
Thankyou for using Microsoft Q&A platform and thanks for posting your question.
As per my understanding, you are trying to run multiple sql queries in a single cell in a databricks notebook. However, it's giving the output of only the last statement in the result section. Please let me know if my understanding is incorrect.
This is by design . You should consider using one show command in each cell. However, as I see your requirement is to get the create table statement for multiple tables at once. You can consider writing your sql queries in pyspark using
spark.sql
function and load the query output in a dataframe and display the dataframe.
Below is the example:
df = spark.sql("show create table customer_table")
display(df)
df1 = spark.sql("show create table customer_table_1")
display(df1)
df2 = spark.sql("show create table customer_table_2")
display(df2)
Hope this will help. Please let us know if any further queries.
------------------------------
- Please don't forget to click on or upvote button whenever the information provided helps you.
Original posters help the community find answers faster by identifying the correct answer. Here is how - Want a reminder to come back and check responses? Here is how to subscribe to a notification
- If you are interested in joining the VM program and help shape the future of Q&A: Here is how you can be part of Q&A Volunteer Moderators