How do you create a new schema in Snowflake? Provide an example SQL statement.
To create a new schema in Snowflake, you can use the **`CREATE SCHEMA`** statement. This command creates a logical container for organizing database objects within the Snowflake database. Here's the SQL syntax for creating a new schema:
```sql
sqlCopy code
CREATE SCHEMA schema_name;
```
- **`schema_name`**: The name you want to give to the new schema.
Here's an example of creating a new schema named **`sales_data`**:
```sql
sqlCopy code
CREATE SCHEMA sales_data;
```
Once the schema is created, you can use it to organize and manage database objects such as tables, views, functions, and more. For instance, you can create tables within the newly created schema:
```sql
sqlCopy code
CREATE TABLE sales_data.sales (
sale_id INT,
sale_date DATE,
amount DECIMAL
);
```
In this example, a schema named **`sales_data`** is created, and a table named **`sales`** is created within that schema. This helps keep related objects together and improves data organization and management within the Snowflake database.