diff --git a/sql/core/src/main/scala/org/apache/spark/sql/execution/command/tables.scala b/sql/core/src/main/scala/org/apache/spark/sql/execution/command/tables.scala index 7ed82b16cc5e2..d25779c0e1946 100644 --- a/sql/core/src/main/scala/org/apache/spark/sql/execution/command/tables.scala +++ b/sql/core/src/main/scala/org/apache/spark/sql/execution/command/tables.scala @@ -1172,7 +1172,12 @@ case class ShowCreateTableCommand( builder.toString() } else { - builder ++= s"CREATE TABLE ${table.quoted} " + + if (tableMetadata.tableType == EXTERNAL) { + builder ++= s"CREATE EXTERNAL TABLE ${table.quoted} " + } else { + builder ++= s"CREATE TABLE ${table.quoted} " + } showCreateDataSourceTable(metadata, builder) builder.toString()