# EVAL

The EVAL command allows you to add new columns to your results by calculating values using expressions, literals, or functions. You can use existing columns or previously defined columns in your calculations.

## Syntax

`EVAL [column1 =] value1[, ..., [columnN =] valueN]`

### Parameters

#### columnX

The name of the column to be created or replaced. If a column with the same name already exists, it will be dropped and replaced by the new column. If a column name is used more than once, only the rightmost duplicate creates a column.

#### valueX

The value assigned to the column. This can be a literal, an expression, or a function. You can reference columns defined to the left of this one.

## Examples

Calculate height in feet and centimeters for each employee:
```esql
FROM employees
| SORT emp_no
| KEEP first_name, last_name, height
| EVAL height_feet = height * 3.281, height_cm = height * 100
```

Replace the existing height column with its value converted to feet:
```esql
FROM employees
| SORT emp_no
| KEEP first_name, last_name, height
| EVAL height = height * 3.281
```

Add a new column for height in feet without specifying a name, so the column is named after the expression:
```esql
FROM employees
| SORT emp_no
| KEEP first_name, last_name, height
| EVAL height * 3.281
```

Calculate height in feet and then compute the average height in feet, referencing the column with special characters using backticks:
```esql
FROM employees
| EVAL height * 3.281
| STATS avg_height_feet = AVG(`height * 3.281`)
```