> ## Documentation Index
> Fetch the complete documentation index at: https://docs.regatta.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Regatta CLI

> A lightweight command-line tool for connecting to, managing, and querying your Regatta database clusters.

The Regatta Command-Line Interface (CLI) provides a quick and convenient way to manage and query your Regatta database. You’ll need:

1. Valid user credentials
2. Network access to an active Regatta cluster

## Installation

<Tabs>
  <Tab title="Linux">
    Copy the Regatta CLI RPM package to your target Linux machine and install it:

    ```bash theme={null}
    sudo rpm -i regatta-cli-<version>.el8.x86_64.rpm
    ```

    Verify the CLI binary is installed:

    ```
    ls /opt/regatta/1.0/clients/cli/bin/client_cli
    ```
  </Tab>
</Tabs>

## Launch the CLI

Start the client:

```bash theme={null}
/opt/regatta/1.0/clients/cli/bin/client_cli
```

You’ll see the prompt:

```powershell theme={null}
rdb>
```

## Connect to Your Cluster

Authenticate with your credentials and cluster address:

```powershell theme={null}
rdb>\connect user=admin pass=RegattaDefault1234! url=aaa.bbb.ccc.ddd:ppp
```

On success, you’ll see:

```
Successfully connected to cluster 
```

<Note>
  NOTE: From this point forward the rdb> prompt will be omitted.
</Note>

## Table Management

### Create a Table

Let's create an `employees` table:

```sql theme={null}
CREATE TABLE employees (
  employee_key INT PRIMARY KEY INDEX,
  employee_name VARCHAR(40) NOT NULL,
  employee_salary INT,
  employee_department VARCHAR(50) NOT NULL);
```

If successful:

```sql theme={null}
statement executed successfully 
```

Verify with:

```sql theme={null}
SHOW TABLES;
```

```sql theme={null}
| TABLE_NAME    | IS_READY | PRIMARY_KEY_COLUMN | DEVICES |
-----------------------------------------------------------
| employees     | true     | employee_key       | m10d1   |
```

### Insert Data

Insert multiple rows:

```sql theme={null}
INSERT INTO employees (
  employee_key,
  employee_name,
  employee_salary,
  employee_department)
VALUES 
  (1,'John Doe', 10932, 'DevOps'),    
  (2,'Richard Roe', 18324, 'Legal'),
  (3,'Jane Roe', 20411, 'SoftwareDev'),
  (4,'Rachel Roe', 19555, 'Support');
```

```sql theme={null}
statement executed successfully  
```

### Query Data

Select all records:

```sql theme={null}
SELECT * from employees;
```

```sql theme={null}
statement executed successfully
| employee_key | employee_name | employee_salary | employee_department |
------------------------------------------------------------------------
|            1 | John Doe      |           10932 | DevOps              |
|            2 | Richard Roe   |           18324 | Legal               |
|            3 | Jane Roe      |           20411 | SoftwareDev         |
|            4 | Rachel Roe    |           19555 | Support             |
```

Filter with a WHERE clause:

```sql theme={null}
SELECT employee_name, employee_salary
FROM employees
WHERE employee_salary > 18324;
```

```sql theme={null}
statement executed successfully
| employee_name | employee_salary |
-----------------------------------
| Jane Roe      |           20411 |
| Rachel Roe    |           19555 |
```

### Update Records

Give Richard Roe a raise:

```sql theme={null}
UPDATE employees SET employee_salary=20202 WHERE employee_name='Richard Roe';
```

Re-run the previous `SELECT` to confirm:

```sql theme={null}
statement executed successfully
| employee_name | employee_salary |
-----------------------------------
| Richard Roe   |           20202 |
| Jane Roe      |           20411 |
| Rachel Roe    |           19555 |
```

### Delete Records

Remove the employee with the highest salary:

```sql theme={null}
DELETE FROM employees
WHERE employee_salary = (
  SELECT MAX(employee_salary)
  FROM employees
);
```

Verify deletion:

```sql theme={null}
statement executed successfully
| employee_name | employee_salary |
-----------------------------------
| Richard Roe   |           20202 |
| Rachel Roe    |           19555 |
```

### Drop the Table

List tables:

```sql theme={null}
SHOW TABLES;
```

This will present all the tables in the database:

```sql theme={null}
| TABLE_NAME    | IS_READY | PRIMARY_KEY_COLUMN | DEVICES |
-----------------------------------------------------------
| employees     | true     | employee_key       | m10d1   |
```

Drop `employees`:

```sql theme={null}
DROP TABLE employees;
```

Confirm it’s gone:

```sql theme={null}
SHOW TABLES
```

```sql theme={null}
statement executed successfully
| TABLE_NAME | IS_READY | PRIMARY_KEY_COLUMN | DEVICES | TABLE_METADATA |
-------------------------------------------------------------------------
```

## Next Steps

* Explore advanced CLI commands usding the [SQL guide](/sql/specification).
* Integrate with your preferred language using one of our [language-specific drivers.](/drivers-and-clients/connecting-applications-to-regatta)
