Skip to content
Merged
Show file tree
Hide file tree
Changes from 80 commits
Commits
Show all changes
82 commits
Select commit Hold shift + click to select a range
03784c2
Add converted SQL reference files
kbatuigas Mar 6, 2026
ac2e755
Duplicate file
kbatuigas Mar 6, 2026
7f4761f
Add index files
kbatuigas Mar 6, 2026
1e4ed39
Add SQL reference to Cloud nav
kbatuigas Mar 6, 2026
f62be7d
Move reference pages to reference module
kbatuigas Mar 10, 2026
4c1357e
Convert remaining docs
kbatuigas Mar 10, 2026
3a1f379
Add placeholder index files
kbatuigas Mar 10, 2026
673fcda
Cleanup
kbatuigas Mar 10, 2026
e90907d
Move SQL section after RPCN
kbatuigas Mar 10, 2026
c934199
Continue cleanup using plugin audit and review
kbatuigas Mar 11, 2026
2a030f1
External links open in new window
kbatuigas Mar 11, 2026
ecb6846
Minor edit to trigger deploy preview
kbatuigas Mar 11, 2026
7056eb0
Migrate degraded state doc
kbatuigas Mar 12, 2026
47eceb3
Minor style edits
kbatuigas Mar 12, 2026
caf7414
Address drift from Oxla changes since mid-Oct 2025
kbatuigas Mar 16, 2026
dc65cd3
Include CREATE TABLE and DROP changes
kbatuigas Mar 16, 2026
d94acb7
Update existing pages with placeholders for pages to be created
kbatuigas Mar 24, 2026
e530956
Another pass at style fixes
kbatuigas Mar 25, 2026
7de5c4e
Missing TODO
kbatuigas Mar 25, 2026
8469333
Add remaining new reference pages to address doc drift
kbatuigas Mar 26, 2026
7caf607
Remove Oxla storage compression references
kbatuigas Mar 27, 2026
424e030
Remove INSERT/UPDATE/DELETE from psycopg2 supported features
kbatuigas Mar 27, 2026
53d5e30
Remove Oxla-specific reasons from java-jdbc unsupported list
kbatuigas Mar 27, 2026
58be629
Remove DELETE/UPDATE references from php-pdo rowCount
kbatuigas Mar 27, 2026
3b9fdb9
Remove CREATE TABLE/INSERT example from select.adoc
kbatuigas Mar 27, 2026
4033afa
Remove table duplication TIP
kbatuigas Mar 27, 2026
db7450e
Fix clumped "SELECTstatement"
kbatuigas Mar 27, 2026
8f027f3
Add missing Venn diagrams to JOIN pages
kbatuigas Mar 27, 2026
5992bc3
Inconsistent formatting with function names and parentheses
kbatuigas Mar 27, 2026
5ee3ffa
Incorrect COUNT logic with HAVING
kbatuigas Mar 27, 2026
151e8c1
Add NULLS FIRST/LAST, fix interval sorting
kbatuigas Mar 27, 2026
008e0bf
Replace CREATE TABLE oxlafunctions example in offset.adoc
kbatuigas Mar 27, 2026
d23a988
Unrelated "employees" text
kbatuigas Mar 27, 2026
09dc45f
Move column compatibility note to set-operations index
kbatuigas Mar 27, 2026
14c5324
Both ROWS and RANGE frame modes are supported
kbatuigas Mar 27, 2026
b425a60
Add GEOMETRY/GEOGRAPHY
kbatuigas Mar 27, 2026
57c9d63
Create sql-operators section with full operator list
kbatuigas Mar 27, 2026
2150a15
timestamp-with-time-zone formatting
kbatuigas Mar 27, 2026
e09f875
Remove internal memory representation for date type
kbatuigas Mar 27, 2026
dbfc6fb
Add month and day conversion note
kbatuigas Mar 27, 2026
e62db4c
Remove internal memory representation from bool type
kbatuigas Mar 27, 2026
856c0ba
System catalogs disambiguation note and 7 new pg_* pages
kbatuigas Mar 27, 2026
dbec2df
Fix nav
kbatuigas Mar 27, 2026
80d8fcf
Move bitwise operators
kbatuigas Mar 27, 2026
9dd55f8
Double check SQL examples and outputs
kbatuigas Apr 2, 2026
faf7176
Remove unix_macros
kbatuigas Apr 2, 2026
faac3f4
Reorganize math and trig function pages
kbatuigas Apr 3, 2026
eb0b6ec
Implement some deferred fixes related to old Oxla examples
kbatuigas Apr 22, 2026
746b672
Fix anchors in xrefs
kbatuigas Apr 23, 2026
86dd60e
Apply QA checklist first pass across SQL reference docs
kbatuigas Apr 23, 2026
3f2bd12
Person 4 edits, including future tense, passive voice
micheleRP Apr 27, 2026
8103f71
more Person 4 edits
micheleRP Apr 27, 2026
69a8652
Person 4 edits
micheleRP Apr 29, 2026
1e7e7a3
Parallelize :description: metadata for SQL language client pages
micheleRP Apr 29, 2026
7ef8449
Apply Feediver1 review suggestions
Feediver1 Apr 29, 2026
c4ec9e2
Apply pending PR suggestion comments
Feediver1 Apr 30, 2026
34de282
Minor edit - statements index
kbatuigas Apr 27, 2026
7aea159
keywords.adoc - move in nav tree, make table more scannable
kbatuigas Apr 27, 2026
a053c6b
alter-table minor edit
kbatuigas Apr 28, 2026
9050995
create-redpanda-catalog: Improve Options section
kbatuigas Apr 28, 2026
2f14615
create-storage minor edit
kbatuigas Apr 28, 2026
fa89fb3
Improve CREATE TABLE reference page clarity
kbatuigas Apr 28, 2026
c71ffa7
select: review fixes
kbatuigas Apr 28, 2026
a1c1810
set-show: review fixes
kbatuigas Apr 28, 2026
ccffb8a
show-tables minor edit
kbatuigas Apr 29, 2026
413a3eb
show-nodes: review fixes
kbatuigas Apr 29, 2026
170622c
describe: review fixes
kbatuigas Apr 29, 2026
78552ca
sql-statements review pass
kbatuigas Apr 29, 2026
f2ed219
from - review pass
kbatuigas Apr 29, 2026
53fc56d
Minor edit
kbatuigas Apr 29, 2026
63f87f0
set-operations: review fixes
kbatuigas Apr 29, 2026
38b5bf0
More review fixes for sql-clauses
kbatuigas Apr 29, 2026
8e2885c
other-functions review fixes
kbatuigas Apr 29, 2026
892dd8d
Normalize QA fixes
kbatuigas Apr 30, 2026
54cd054
Apply edits based on doc team review
kbatuigas May 1, 2026
e8da274
Standardize "To do X, run:"
kbatuigas May 1, 2026
26117f0
Structural improvements
kbatuigas May 1, 2026
0e2b04e
Sweep for passive voice
kbatuigas May 1, 2026
7661780
Person 2 style review: aggregate, window, JSON functions
JakeSCahill Apr 29, 2026
373d7ff
Pass to standardize QA
kbatuigas May 1, 2026
3cf6552
Apply suggestions from review
kbatuigas May 1, 2026
e94f075
Minor edits
kbatuigas May 1, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
232 changes: 232 additions & 0 deletions modules/ROOT/nav.adoc

Large diffs are not rendered by default.

Binary file added modules/reference/images/sql/join-venn.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
61 changes: 61 additions & 0 deletions modules/reference/pages/sql/comment-support.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
= Comment Support
:description: Redpanda SQL fully supports comments in your queries.
:page-topic-type: reference

Redpanda SQL fully supports comments in your queries. Comments provide a way to add explanatory notes and improve the readability of queries, making it easier for developers and stakeholders to understand complex queries.

There are two types of comments in Redpanda SQL: single-line and multi-line (block).

== Single line comments

A single-line comment in Redpanda SQL starts with two consecutive hyphens (--) and extends to the end of the line. Use these comments to annotate specific parts of a query with brief explanations or notes that help readers understand the query.

=== Syntax

[source,sql]
----
-- This is an example single line comment
----

== Multi-line (block) comments

Redpanda SQL also supports multi-line comments, often referred to as block comments. These comments begin with `/*` and end with `*/`, allowing for multi-line explanations or temporarily disabling sections of the query.

=== Syntax

[source,sql]
----
/*
This is an example multi-line comment.
It can span multiple lines and is useful for providing detailed explanations.
*/
----

== Comment placement

In Redpanda SQL, single-line comments should always be placed at the end of the line they refer to, whereas multi-line comments can be positioned anywhere within the query.

=== Comment on a single line

[source,sql]
----
SELECT column1, column2 -- This is an example single line comment
FROM table_name;
----

=== Comment on multiple lines

[source,sql]
----
SELECT /* comment 1 */ column1, column2
FROM table_name /* comment 2 */
WHERE column3 = 42 /* comment 3 */ ;
----

== Best practices for commenting

To maximize the benefits of comments in Redpanda SQL queries, follow these best practices:

* Be concise. Write clear and concise comments that provide meaningful insights into the specific parts of the query.
* Update comments during code changes. Whenever the query is modified, update the associated comments to reflect the changes accurately.
* Avoid over-commenting. While comments are helpful, excessive commenting can clutter the code and reduce readability.
12 changes: 12 additions & 0 deletions modules/reference/pages/sql/index.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
= SQL Reference
:description: This section provides information about the syntax and semantics of SQL queries, clauses, data types, and functions that Redpanda SQL supports.

This section provides information about the syntax and semantics of SQL queries, clauses, data types, and functions that Redpanda SQL supports. The information in this section is divided into groups according to the kind of operation they perform as follows:

* xref:reference:sql/sql-statements/index.adoc[SQL Statements]. Learn how to create a request for data or information from one or more database tables using supported statements.
* xref:reference:sql/sql-clauses/index.adoc[SQL Clauses]. Learn how to write user-friendly queries and analyze data using different constraints and conditions.
* xref:reference:sql/sql-data-types/index.adoc[SQL Data Types]. Learn how to implement supported data types to run your operations, such as text, timestamp, numeric, and many more.
* xref:reference:sql/sql-functions/index.adoc[SQL Functions]. See how you can combine statements, data types, and other references into specific functions for particular tasks.
* xref:reference:sql/schema.adoc[Schema]. Learn about a logical container that holds database objects and relationships of data in a database.
* xref:reference:sql/comment-support.adoc[Comment Support]. Add comments in your queries for better documentation and collaboration.
* xref:reference:sql/transactions.adoc[Transactions]. Learn more about managing your transactions.
81 changes: 81 additions & 0 deletions modules/reference/pages/sql/redpanda-catalogs.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
= Redpanda Catalogs
:description: Redpanda catalogs are named connections that map Redpanda topics to queryable SQL tables.
:page-topic-type: reference

Redpanda catalogs are named connections that let you query Redpanda topics using standard SQL. The catalog model consists of three core concepts:

* Catalogs: Named connections to a Redpanda cluster, created with xref:reference:sql/sql-statements/create-redpanda-catalog.adoc[CREATE REDPANDA CATALOG].
* Tables: Redpanda topics mapped as queryable SQL tables using the `catalog_name\=>table_name` syntax, created with xref:reference:sql/sql-statements/create-table.adoc[CREATE TABLE].
* Storage connections: Named connections to external object storage such as Amazon S3, created with xref:reference:sql/sql-statements/create-storage.adoc[CREATE STORAGE].

NOTE: Redpanda SQL operates in read-only mode. Data mutation operations such as `INSERT`, `UPDATE`, and `DELETE` are not available. Data is ingested into Redpanda topics and made queryable through catalog mappings.

== Typical workflow

To query Redpanda topic data with SQL:

. Create a catalog connection:
+
[source,sql]
----
CREATE REDPANDA CATALOG my_catalog
WITH (
initial_brokers = 'broker1:9092',
schema_registry_url = 'http://schema-registry:8081'
);
----

. Map a topic as a table:
+
[source,sql]
----
CREATE TABLE my_catalog=>user_events
WITH (topic = 'user-events');
----

. Query the data:
+
[source,sql]
----
SELECT * FROM my_catalog=>user_events LIMIT 10;
----

== Related statements

[cols="<40%,<60%",options="header"]
|===
|Statement |Description

|xref:reference:sql/sql-statements/create-redpanda-catalog.adoc[CREATE REDPANDA CATALOG]
|Create a catalog connection to a Redpanda cluster.

|xref:reference:sql/sql-statements/alter-redpanda-catalog.adoc[ALTER REDPANDA CATALOG]
|Modify connection properties of an existing catalog.

|xref:reference:sql/sql-statements/create-table.adoc[CREATE TABLE]
|Map a Redpanda topic to a SQL table through a catalog.

|xref:reference:sql/sql-statements/alter-table.adoc[ALTER TABLE]
|Modify options of an existing catalog table.

|xref:reference:sql/sql-statements/drop-table.adoc[DROP TABLE]
|Remove a catalog table mapping.

|xref:reference:sql/sql-statements/drop-redpanda-catalog.adoc[DROP REDPANDA CATALOG]
|Remove a Redpanda catalog connection.

|xref:reference:sql/sql-statements/drop-storage.adoc[DROP STORAGE]
|Remove a named storage definition.

|xref:reference:sql/sql-statements/show-tables.adoc[SHOW TABLES]
|List tables within a catalog.

|xref:reference:sql/sql-statements/describe.adoc[DESCRIBE]
|Show details about a catalog or catalog table.

|xref:reference:sql/sql-statements/create-storage.adoc[CREATE STORAGE]
|Create a connection to external object storage.

|xref:reference:sql/sql-statements/alter-storage.adoc[ALTER STORAGE]
|Modify an existing storage connection.
|===
228 changes: 228 additions & 0 deletions modules/reference/pages/sql/schema.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,228 @@
= Schemas
:description: Schemas are namespaces that organize tables and other database objects in Redpanda SQL.
:page-topic-type: reference

A schema is a namespace that groups related database objects, including tables, views, indexes, sequences, data types, operators, and functions. Schemas let you organize objects into logical groups so their names do not collide.

Redpanda SQL supports multiple schemas in a single database. For example, in a database named `mydb`, you might define schemas such as `auth`, `model`, and `business`.

== Default schema

By default, Redpanda SQL uses the `public` schema. When you reference an unqualified table name, it is equivalent to `public.table_name`. The same rule applies to `CREATE`, `DROP`, and `SELECT` statements.

== Syntax

=== Create a schema

[source,sql]
----
CREATE SCHEMA [IF NOT EXISTS] schema_name;
----

* `schema_name`: Name of the schema to create.
* `IF NOT EXISTS`: Optional. Prevents an error if the schema already exists.

=== Create a table in a schema

[source,sql]
----
CREATE TABLE schema_name.table_name(
...
);
----

* `schema_name`: Name of an existing schema.
* `table_name`: Name of the table to create.

=== Query a table in a schema

[source,sql]
----
SELECT * FROM schema_name.table_name;
----

* `schema_name`: Name of the schema.
* `table_name`: Name of the table to query.

=== Drop a schema

To drop an empty schema:

[source,sql]
----
DROP SCHEMA [IF EXISTS] schema_name;
----

* `schema_name`: Name of the schema to drop.
* `IF EXISTS`: Optional. Prevents an error if the schema does not exist.

To drop a schema that contains tables, use `CASCADE` to drop the schema and its contents:

[source,sql]
----
DROP SCHEMA schema_name CASCADE;
----

== Examples

=== Create a schema and table

. Create a schema:
+
[source,sql]
----
CREATE SCHEMA app_data;
----

. Create a table in the `app_data` schema and insert rows:
+
[source,sql]
----
CREATE TABLE app_data.functions(
id int,
function_name text,
active bool
);

INSERT INTO app_data.functions(id, function_name, active)
VALUES
('1111', 'Numeric', 'TRUE'),
('2222', 'Text', 'TRUE'),
('3333', 'Timestamp', 'TRUE'),
('4444', 'JSON', 'TRUE'),
('5555', 'Boolean', 'TRUE');
----

. Verify the table contents:
+
[source,sql]
----
SELECT * FROM app_data.functions;
----

. The query returns:
+
[source,sql]
----
+------+---------------+---------+
| id | function_name | active |
+------+---------------+---------+
| 1111 | Numeric | t |
| 2222 | Text | t |
| 3333 | Timestamp | t |
| 4444 | JSON | t |
| 5555 | Boolean | t |
+------+---------------+---------+
----

=== Use IF NOT EXISTS

The `IF NOT EXISTS` option lets the `CREATE SCHEMA` query succeed without error when the schema already exists. The schema is not modified.

==== Without IF NOT EXISTS

. Create a schema:
+
[source,sql]
----
CREATE SCHEMA analytics;
----
+
The query returns:
+
[source,sql]
----
CREATE SCHEMA
----

. Run the same `CREATE SCHEMA` statement again. The query fails with an error:
+
[source,sql]
----
CREATE SCHEMA analytics;
----
+
The query returns:
+
[source,sql]
----
ERROR: Schema: analytics already exists
----

==== With IF NOT EXISTS

Run the same `CREATE SCHEMA` statement with `IF NOT EXISTS`. The query succeeds without error:

[source,sql]
----
CREATE SCHEMA IF NOT EXISTS analytics;
----

[source,sql]
----
CREATE
----

=== Drop a schema

To drop a schema and all its tables, use `CASCADE`:

[source,sql]
----
DROP SCHEMA app_data CASCADE;
----

If the schema is empty, you can drop it without `CASCADE`:

[source,sql]
----
DROP SCHEMA app_data;
----

=== Use IF EXISTS

The `IF EXISTS` option lets the `DROP SCHEMA` query succeed without error when the schema does not exist.

==== Without IF EXISTS

. Drop a schema:
+
[source,sql]
----
DROP SCHEMA analytics;
----
+
The query returns:
+
[source,sql]
----
DROP
----

. Run the same `DROP SCHEMA` statement again. The query fails with an error:
+
[source,sql]
----
DROP SCHEMA analytics;
----
+
The query returns:
+
[source,sql]
----
ERROR: schema "analytics" does not exist
----

==== With IF EXISTS

Run the same `DROP SCHEMA` statement with `IF EXISTS`. The query succeeds without error:

[source,sql]
----
DROP SCHEMA IF EXISTS analytics;
----

[source,sql]
----
DROP
----
Loading