# SQL

SQL is the primary interface for DeltaStream. Using a simple and familiar SQL interface, you can

* create databases
* run continuous queries
* build materialized views
* and more

DeltaStream also provides SQL extensions that enable you to express streaming concepts that don’t have equivalents in traditional SQL.

## DDL

SQL DDLs are queries that create, delete, or modify database structures. Unlike queries, DDLs do not process data. Examples of useful DDLs include:

* [creating databases](/reference/sql-syntax/ddl/create-database.md)
* [creating streams](/reference/sql-syntax/ddl/create-stream.md)
* [dropping entities](/reference/sql-syntax/ddl/drop-entity.md)
* [updating stores](/reference/sql-syntax/ddl/update-store.md)

DDLs are useful in both the DeltaStream UI and the CLI. However, the UI also provides an interface for many of these DDLs, such as creating [stores](/overview/core-concepts/store.md).

For a full list of SQL DDLs, go to [the DDL page](/reference/sql-syntax/ddl.md) of the [SQL Syntax](/reference/sql-syntax.md) section.

## Query

There are two main types of SQL queries that do process data:

1. [Streaming or continuous queries](/overview/core-concepts/queries.md#_streaming_or_continuous_query)
2. [Materialized view queries](/overview/core-concepts/queries.md#query-on-materialized-views)

See more about both in the [Query](/overview/core-concepts/queries.md) page under [Core Concepts](/overview/core-concepts.md).

When you write streaming queries in the UI, successful queries display in the **Query** tab. Interactive streaming queries and queries on materialized views both print results on the page. Similarly, for the CLI you can list successful streaming queries with the [LIST QUERIES](/reference/sql-syntax/command/list-queries.md) command; interactive streaming queries and queries on materialized views in this case print results directly in the console.

For a full list of SQL queries, go to the [Query](/reference/sql-syntax/query.md) section under [SQL Syntax](/reference/sql-syntax.md).

## Command

SQL commands are actions that do not change database entities and do not process data. Examples of useful commands include:

* listing and describing DeltaStream entities
* inviting users to your organization
* granting privileges
* printing the records in [entities](/overview/core-concepts/store.md#entity)

SQL commands are useful when using the CLI. DeltaStream provides the functionality of these commands through its UI.

For a full list of SQL commands, go to the [Commands](/reference/sql-syntax/command.md) section under [SQL Syntax](/reference/sql-syntax.md).


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.deltastream.io/overview/core-concepts/sql.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
