> For the complete documentation index, see [llms.txt](https://docs.reorc.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.reorc.com/data-service/create-and-edit-data-service.md).

# Create & edit Data Service

{% hint style="info" %}
Only users with Manage/Edit permission can create & edit the Data Service.
{% endhint %}

## Create a Data Service

To create a Data Service, follow these steps:

1. In your ReOrc project, go to **Data Service**.
2. Click on the **+** icon and select **Create data service.**
3. Provide the name for your Data Service.
4. Click **Create.**

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

## Define SQL query

1. Click **Edit query** to define/ edit SQL query of the Data Service.
2. In the query editor, define connection for your Data Service.
3. Input your SQL query.

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

{% hint style="info" %}
When SQL contains field aliases, please add "AS" explicitly and the corresponding identifier for the different databases, and avoid `SELECT *`syntax
{% endhint %}

For example:

```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. Click **Update > Save** to confirm the changes.
5. View the query output in the **Data Preview** tab.

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

## Organize Data Services

To create a new folder, click on the action button of an existing folder and select **Add sub-folder**:

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

To move a Data Service into the new folder, click on the action button of the Data Service and select **Move to**. Then select the target folder from the list.

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