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

# Create and query a semantic view

> Define business metrics and dimensions, run a query, and verify its results.

Use a semantic view to define how tables relate and how business metrics should be calculated. Start with one metric and a dimension so you can compare the result with a query you already trust.

## 1. Define the business model

Identify the source tables, join keys, and the grain of the result. Check that the key on the dimension side is unique. Then define the relationships, dimensions, and metric expression in [CREATE SEMANTIC VIEW](/documents/4.2/sql-reference/sql-statements/semantic-view/CREATE_SEMANTIC_VIEW.md).

## 2. Query a metric by dimension

Select the metrics and dimensions by their model names in [a semantic view query](/documents/4.2/sql-reference/sql-statements/semantic-view/QUERY_SEMANTIC_VIEW.md). For a first check, use the same filters and grouping as the equivalent query on the source tables.

## 3. Verify the result and inspect the definition

Compare the rows and totals with the equivalent SQL. If the results differ, use `EXPLAIN SNOWFLAKE` to inspect the model relationships and `EXPLAIN INLINE` to see the expanded SQL. Use [SHOW CREATE SEMANTIC VIEW](/documents/4.2/sql-reference/sql-statements/semantic-view/SHOW_CREATE_SEMANTIC_VIEW.md) to check the stored definition.

Follow the [worked example](/documents/4.2/using_starrocks/semantic_view.md#quick-start) to model and query order revenue by customer. To trace the tables and columns behind a model, see [semantic view lineage](/documents/4.2/using_starrocks/semantic_view_openlineage.md).


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