-
Notifications
You must be signed in to change notification settings - Fork 29k
[SPARK-28810][DOC][SQL] Document SHOW TABLES in SQL Reference. #25561
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Closed
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
77e753a
Updated the document details
shivusondur 5178160
Updated the document according to latest comments
shivusondur 19f39fc
1. changed to "Parameters"
shivusondur 55ea2cf
1. Added the one more example to demonstrate the "|" wild card
shivusondur 0dd4efb
Added the space between examples
shivusondur 1d08b22
Updated the description
shivusondur 847fb8e
Updated the description
shivusondur 05a2e60
handled the comments
shivusondur fed9431
handled the comments
shivusondur 83cff5d
handled the comments
shivusondur f3e1c31
handled the comments
shivusondur 8e1e114
handled the comments
shivusondur e26f55b
handled the comments
shivusondur File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -18,5 +18,90 @@ license: | | |
| See the License for the specific language governing permissions and | ||
| limitations under the License. | ||
| --- | ||
| ### Description | ||
|
|
||
| **This page is under construction** | ||
| The `SHOW TABLES` statement returns all the tables for an optionally specified database. | ||
| Additionally, the output of this statement may be filtered by an optional matching | ||
| pattern. If no database is specified then the tables are returned from the | ||
| current database. | ||
|
|
||
| ### Syntax | ||
| {% highlight sql %} | ||
| SHOW TABLES [{FROM|IN} database_name] [LIKE 'regex_pattern'] | ||
| {% endhighlight %} | ||
|
|
||
| ### Parameters | ||
| <dl> | ||
| <dt><code><em>{FROM|IN} database_name</em></code></dt> | ||
| <dd> | ||
| Specifies the database name from which tables are listed. | ||
| </dd> | ||
| <dt><code><em>LIKE regex_pattern</em></code></dt> | ||
| <dd> | ||
| Specifies the regular expression pattern that is used to filter out unwanted tables. | ||
| <ul> | ||
| <li> Except for `*` and `|` character, the pattern works like a regex.</li> | ||
| <li> `*` alone matches 0 or more characters and `|` is used to separate multiple different regexes, | ||
| any of which can match. </li> | ||
| <li> The leading and trailing blanks are trimmed in the input pattern before processing.</li> | ||
| </ul> | ||
|
|
||
| </dd> | ||
| </dl> | ||
|
|
||
| ### Example | ||
| {% highlight sql %} | ||
| -- List all tables in default database | ||
| SHOW TABLES; | ||
| +-----------+------------+--------------+--+ | ||
| | database | tableName | isTemporary | | ||
| +-----------+------------+--------------+--+ | ||
| | default | sam | false | | ||
| | default | sam1 | false | | ||
| | default | suj | false | | ||
| +-----------+------------+--------------+--+ | ||
|
|
||
| -- List all tables from userdb database | ||
| SHOW TABLES FROM userdb; | ||
| +-----------+------------+--------------+--+ | ||
| | database | tableName | isTemporary | | ||
| +-----------+------------+--------------+--+ | ||
| | userdb | user1 | false | | ||
| | userdb | user2 | false | | ||
| +-----------+------------+--------------+--+ | ||
|
|
||
| -- List all tables in userdb database | ||
| SHOW TABLES IN userdb; | ||
| +-----------+------------+--------------+--+ | ||
| | database | tableName | isTemporary | | ||
| +-----------+------------+--------------+--+ | ||
| | userdb | user1 | false | | ||
| | userdb | user2 | false | | ||
| +-----------+------------+--------------+--+ | ||
|
|
||
| -- List all tables from default database matching the pattern `sam*` | ||
| SHOW TABLES FROM default LIKE 'sam*'; | ||
| +-----------+------------+--------------+--+ | ||
| | database | tableName | isTemporary | | ||
| +-----------+------------+--------------+--+ | ||
| | default | sam | false | | ||
| | default | sam1 | false | | ||
| +-----------+------------+--------------+--+ | ||
|
|
||
| -- List all tables matching the pattern `sam*|suj` | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nit: can we have a line between previous test and this one.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @dilipbiswal |
||
| SHOW TABLES LIKE 'sam*|suj'; | ||
| +-----------+------------+--------------+--+ | ||
| | database | tableName | isTemporary | | ||
| +-----------+------------+--------------+--+ | ||
| | default | sam | false | | ||
| | default | sam1 | false | | ||
| | default | suj | false | | ||
| +-----------+------------+--------------+--+ | ||
|
|
||
| {% endhighlight %} | ||
shivusondur marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| ### Related statements | ||
| - [CREATE TABLE](sql-ref-syntax-ddl-create-table.html) | ||
| - [DROP TABLE](sql-ref-syntax-ddl-drop-table.html) | ||
| - [CREATE DATABASE](sql-ref-syntax-ddl-create-database.html) | ||
| - [DROP DATABASE](sql-ref-syntax-ddl-drop-database.html) | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please lets fix the formatting. Did we construct this output by hand ? Can we paste the
actual output here please so we preserve the formatting.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@dilipbiswal

I just Copy and paste the actual output from the Beeline console
Here is the beeline console snap
In the UI it looks like below, i think it is normal

Only in the git file editor, it shows inconsistent.