Description
This statement is used to switch the schema in the current database, so that users can more easily operate and manage data tables under different schemas.
Syntax
Parameter Description
SCHEMA: This is an optional keyword, you can use or omit it.schema_name: Specifies the name of the schema to switch to.
Usage Example
- Switch to the schema named
ods_schema: - Switch to the schema named
reporting_schema, omitting theSCHEMAkeyword: - Switch to the schema named
customer_dataand perform some query operations after switching:
Precautions
- When you use the
USEstatement in an SQL query to switch to a certain schema, the subsequent query operations will default to the data tables under that schema. - If you need to frequently switch between multiple schemas, you can use the
USEstatement multiple times in the SQL query. - When using the
USEstatement, please ensure that the specified schema name exists in the current database, otherwise it will cause an error.
