# 创建和编辑

{% hint style="info" %}
只有拥有项目内“管理者/开发者”权限的用户才能创建和编辑数据服务。
{% endhint %}

## **创建数据服务**

要创建一个数据服务，请按照以下步骤操作：

1. 在你的项目中，进入 **数据服务** 页面。
2. 点击 **+** 图标，选择 **创建数据服务（Create data service）**。
3. 输入你要创建的数据服务的名称。
4. 点击 **创建（Create）**。

<figure><img src="/files/SZZ9pS56fCxw3n898pcl" alt=""><figcaption></figcaption></figure>

## **定义 SQL 查询**

1. 点击 **编辑查询（Edit query）**，定义或编辑数据服务的 SQL 查询。
2. 在查询编辑器中，为你的数据服务选择数据连接。
3. 输入你的 SQL 查询语句。

> **注意**：
>
> * 当 SQL 查询中包含字段别名时，请务必显式地添加 `AS` 关键字，并根据数据库使用相应的标识符。
> * 避免使用 `SELECT *` 语法。

<figure><img src="/files/tB402I9bO7ZTcT6kCtbY" alt=""><figcaption></figcaption></figure>

例如：

```sql
SELECT
    o.id AS order_id,
    c.name AS customer_name,
    o.order_total
FROM
    database_name.table_name o
JOIN
    database_name.table_name c ON o.customer = c.id
WHERE
    o.order_status = 'completed';
```

4. 点击 **更新（Update） > 保存（Save）**，以确认修改。
5. 在 **数据预览（Data Preview）** 标签页中查看查询结果。

## **管理 Data Service**

* **创建文件夹：**&#x70B9;击现有文件夹的操作按钮，选择 **添加文件夹**，即可创建新的文件夹。

<figure><img src="/files/bhf45haVO7VkUW3xlB5q" alt="" width="349"><figcaption></figcaption></figure>

* **移动：**&#x70B9;击某个数据服务的操作按钮，选择 **移动**，然后从列表中选择目标文件夹。

  <figure><img src="/files/e5XxXHkygsnXIZmb3AXI" alt="" width="355"><figcaption></figcaption></figure>


---

# 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.reorc.com/cn-reorc-help-center/data-service/chuang-jian-he-bian-ji.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.
