morrySnow commented on code in PR #1937: URL: https://github.com/apache/doris-website/pull/1937#discussion_r1928201063
########## docs/sql-manual/sql-statements/session/context/USE-DATABASE.md: ########## @@ -25,41 +25,72 @@ specific language governing permissions and limitations under the License. --> - - ## Description -The USE command allows us to use the database +Used to switch to the specified database or compute group. -grammar: +## Syntax ```SQL -USE <[CATALOG_NAME].DATABASE_NAME> +USE { [<catalog_name>.]<database_name>[@<compute_group_name>] | @<compute_group_name> } ``` -illustrate: +## Required Parameters + +Switch to the specified database. + + **1. `<database_name>`** + > The name of the database to switch to. + > If no catalog is specified, the current catalog is used by default. + +Switch to the specified compute group only. + + **1. `<compute_group_name>`** + > The name of the compute group to switch to. + +## Optional Parameters -1. `USE CATALOG_NAME.DATABASE_NAME` will switch the current catalog into `CATALOG_NAME` and then change the current database into `DATABASE_NAME` +Switch to the specified database. -## Example + **1. `<catalog_name>`** + > The name of the catalog to switch to. + + **2. `<compute_group_name>`** + > The name of the compute group to switch to. -1. If the demo database exists in current catalog, try accessing it: +## Access Control Requirements + +| Privilege | Object | Notes | +|-------------|-----------------------|----------------------------------------------------------------------| +| SELECT_PRIV | Catalog, Database | SELECT_PRIV privilege is required on the catalog or database to switch to. | +| USAGE_PRIV | Compute Group | USAGE_PRIV privilege is required on the compute group to switch to. | + +## Examples + +1. If the `demo` database exists, try to use it: ```sql mysql> use demo; Database changed ``` -2. If the demo database exists in catalog hms_catalog, try switching the catalog and accessing it: +2. If the `demo` database exists under the `hms_catalog` catalog, try to switch to `hms_catalog` and use it: - ```sql - mysql> use hms_catalog.demo; - Database changed - ``` + ```sql + mysql> use hms_catalog.demo; Review Comment: 去掉 `mysql>` 这个prompt -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For additional commands, e-mail: commits-h...@doris.apache.org