---
title: "SQL Executor"
description: "EMILY.RPA SQL Executor module: connect to a database, run SQL commands and process the results with Low-Code."
source: https://docs.emily.tips/en/wap/sqlexecutor
---

# SQL Executor

Connect to a specified database, execute SQL commands, and analyze the results.

![](https://docs.emily.tips/img/en/wap-201.png)

## Parameters

**`TYPE`** - Select the database type. Supports `mysql`, `postgres`, `oracle`, `mssql`, and other database types.

**`HOST`** - Database host, can be an IP address or host domain name.

**`PORT`** - Database host port number.

**`USER`** - User account name for connecting to the database. Supports the **%FILENAME%** variable.

**`PASSWORD`** - User account password for connecting to the database. Supports the **%FILENAME%** variable.

**`DATABASE`** - Database name. Supports the **%FILENAME%** variable.

**`SQL STATEMENT`** - SQL command to execute on the specified database. **%FILENAME%** template:
```
SELECT * from %price%;
```

## No-Code Editor

![](https://docs.emily.tips/img/en/wap-202.png)

## Low-Code Editor

![](https://docs.emily.tips/img/en/wap-203.png)

### input Array

Each element in the input array represents a row of data from the SQL query. The key in the object is the table column, and the value is the data for that column in this row.

### output Object

Each key added to the output object will be exported as a TXT file in the working folder. The filename is the key, and the text content is the corresponding value.

```javascript
// Write analysis results to total.txt in the working folder
let total = 0
input.forEach((row) => total = total + row.price)
output['total'] = total
```
