spark-instrumented-optimizer/docs/sql-ref-syntax-aux-show-databases.md
Huaxin Gao d34cb59fb3 [SPARK-31556][SQL][DOCS] Document LIKE clause in SQL Reference
### What changes were proposed in this pull request?
Document LIKE clause in SQL Reference

### Why are the changes needed?
To make SQL Reference complete

### Does this PR introduce any user-facing change?
Yes

<img width="1050" alt="Screen Shot 2020-04-25 at 5 49 57 PM" src="https://user-images.githubusercontent.com/13592258/80294346-5babab80-871d-11ea-8ac9-51bbab0aca88.png">

<img width="1050" alt="Screen Shot 2020-04-25 at 5 50 24 PM" src="https://user-images.githubusercontent.com/13592258/80294347-5ea69c00-871d-11ea-8c51-7a90ee20f7da.png">

<img width="1050" alt="Screen Shot 2020-04-25 at 5 50 42 PM" src="https://user-images.githubusercontent.com/13592258/80294351-61a18c80-871d-11ea-9e75-e3345d2f52f5.png">

### How was this patch tested?
Manually build and check

Closes #28332 from huaxingao/where_clause.

Authored-by: Huaxin Gao <huaxing@us.ibm.com>
Signed-off-by: Takeshi Yamamuro <yamamuro@apache.org>
2020-04-29 09:17:23 +09:00

2.7 KiB

layout title displayTitle license
global SHOW DATABASES SHOW DATABASES Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Description

Lists the databases that match an optionally supplied string pattern. If no pattern is supplied then the command lists all the databases in the system. Please note that the usage of SCHEMAS and DATABASES are interchangeable and mean the same thing.

Syntax

{% highlight sql %} SHOW { DATABASES | SCHEMAS } [ LIKE regex_pattern ] {% endhighlight %}

Parameters

regex_pattern
Specifies a regular expression pattern that is used to filter the results of the statement.
  • Only * and | are allowed as wildcard pattern.
  • Excluding * and |, the remaining pattern follows the regular expression semantics.
  • The leading and trailing blanks are trimmed in the input pattern before processing. The pattern match is case-insensitive.

Examples

{% highlight sql %} -- Create database. Assumes a database named default already exists in -- the system. CREATE DATABASE payroll_db; CREATE DATABASE payments_db;

-- Lists all the databases. SHOW DATABASES; +------------+ |databaseName| +------------+ | default| | payments_db| | payroll_db| +------------+

-- Lists databases with name starting with string pattern pay SHOW DATABASES LIKE 'pay*'; +------------+ |databaseName| +------------+ | payments_db| | payroll_db| +------------+

-- Lists all databases. Keywords SCHEMAS and DATABASES are interchangeable. SHOW SCHEMAS; +------------+ |databaseName| +------------+ | default| | payments_db| | payroll_db| +------------+ {% endhighlight %}