# Export: SQL Query

> Export a data contract to a SQL SELECT query.

#  Export: SQL Query

Exports a data contract to a SQL `SELECT` query over the contract's fields.

{/* AUTOGENERATED EXAMPLE: do not edit by hand; regenerate with the update script. */}

```bash
datacontract export sql-query orders.odcs.yaml --schema-name orders
```

Running this against the [example `orders` contract](https://github.com/datacontract/datacontract-cli/blob/main/examples/orders/orders.odcs.yaml) produces:

```sql
-- Data Contract: urn:datacontract:checkout:orders
-- SQL Dialect: snowflake
select
    order_id,
    order_timestamp,
    customer_id,
    order_total,
    status
from orders
```

{/* END AUTOGENERATED EXAMPLE */}

All options: **[`datacontract export sql-query`](../commands/export/sql-query.md)**.
