> ## Documentation Index
> Fetch the complete documentation index at: /documents/llms.txt
> Use this file to discover all available pages before exploring further.

# SHOW CREATE SEMANTIC VIEW

> 返回定义某个语义视图所使用的 CREATE SEMANTIC VIEW 语句。

## 功能

返回用于创建指定语义视图的原始 `CREATE SEMANTIC VIEW` DDL 语句。

## 语法

```SQL theme={null}
SHOW CREATE SEMANTIC VIEW [<db>.]<view_name>
```

## 参数说明

| 参数 | 是否必填 | 说明 |
| - | - | - |
| `db` | 否 | 语义视图所在的数据库，默认为当前数据库。 |
| `view_name` | 是 | 语义视图的名称。 |

## 返回值

| 列 | 说明 |
| - | - |
| `Semantic View` | 语义视图的名称。 |
| `Create Semantic View` | `CREATE SEMANTIC VIEW` 语句的完整 DDL 文本。 |

## 示例

```SQL theme={null}
SHOW CREATE SEMANTIC VIEW sales_db.order_metrics;
```

示例输出：

```
+----------------+--------------------------------------------------------------------+
| Semantic View  | Create Semantic View                                               |
+----------------+--------------------------------------------------------------------+
| order_metrics  | CREATE SEMANTIC VIEW sales_db.order_metrics                        |
|                |   TABLES (                                                         |
|                |     orders   AS sales_db.orders   PRIMARY KEY (o_orderkey),       |
|                |     customer AS sales_db.customer PRIMARY KEY (c_custkey)          |
|                |   )                                                                |
|                |   RELATIONSHIPS (                                                  |
|                |     ord_to_cust AS orders (o_custkey) REFERENCES customer          |
|                |   )                                                                |
|                |   DIMENSIONS (                                                     |
|                |     orders.order_date AS o_orderdate                               |
|                |   )                                                                |
|                |   METRICS (                                                        |
|                |     orders.total_price AS SUM(o_totalprice)                        |
|                |   )                                                                |
+----------------+--------------------------------------------------------------------+
```

## 相关文档

* [CREATE SEMANTIC VIEW](/documents/cn/4.2/sql-reference/sql-statements/semantic-view/CREATE_SEMANTIC_VIEW.md)
* [DROP SEMANTIC VIEW](/documents/cn/4.2/sql-reference/sql-statements/semantic-view/DROP_SEMANTIC_VIEW.md)
* [SHOW SEMANTIC VIEWS](/documents/cn/4.2/sql-reference/sql-statements/semantic-view/SHOW_SEMANTIC_VIEWS.md)
* [语义视图](/documents/cn/4.2/using_starrocks/semantic_view.md)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.