Files
dbx/docs/content/docs/query-editor.cn.mdx
T
t8y2 89fa8c02be docs: add landing page and upgrade all documentation with advanced components
- Add product landing page with hero section, stats, feature cards, database badges, comparison table, and screenshots
- Register Fumadocs MDX components (Tabs, Steps, Callout, Cards, Accordions) globally
- Rewrite all 17 doc pages (CN + EN) with richer content, use cases, and advanced components
- Add competitive comparison table (vs DBeaver/Navicat/TablePlus)
- Add ~300 lines of responsive landing page CSS
2026-05-07 14:53:35 +08:00

50 lines
1.9 KiB
Plaintext
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
---
title: 查询编辑器
description: 基于 CodeMirror 6 的 SQL 编辑器,语法高亮、智能补全、JOIN 建议和查询历史。
---
<Callout type="info">
基于 CodeMirror 6 构建,深度感知数据库元数据,SQL 编写体验媲美 IDE。
</Callout>
## 语法高亮
编辑器针对不同的 SQL 元素(关键字、表名、字符串、数字、注释等)提供语法着色,使 SQL 语句结构一目了然。高亮规则会根据当前连接的数据库类型自动适配。
## SQL 自动补全
在编辑器中输入时,DBX 会自动弹出补全建议:
- **关键字** — `SELECT`、`FROM`、`WHERE`、`GROUP BY` 等 SQL 关键字
- **表名** — 当前数据库中的所有表和视图
- **字段名** — 根据已输入的表名,自动补全对应的字段
- **JOIN 补全** — 输入 `JOIN` 后,自动建议可关联的表及基于外键的关联条件
补全列表会随着输入内容实时过滤,按 `Tab` 或 `Enter` 即可确认选择。
## 执行查询
<Callout type="info">
快捷键:`Cmd+Enter`(macOS)/ `Ctrl+Enter`(Windows/Linux)。选中文本时,仅执行选中部分。
</Callout>
| 操作 | 快捷键 |
|---|---|
| 执行全部 SQL | `Cmd+Enter` / `Ctrl+Enter` |
| 执行选中的 SQL | 先选中文本,再按 `Cmd+Enter` / `Ctrl+Enter` |
执行结果会显示在编辑器下方的数据表格中,包括返回的数据行、执行耗时和影响行数。
## SQL 格式化
点击工具栏中的格式化按钮,可以将当前 SQL 语句自动格式化为统一的缩进和换行风格,便于阅读和维护。
## 查询历史
DBX 会自动记录你执行过的 SQL 语句:
- 在查询历史面板中浏览之前执行过的所有 SQL
- 点击某条历史记录,将其填入编辑器重新执行
- 按时间顺序查看历史记录
- 每个连接独立记录,切换连接后只显示该连接的历史