# Pre-Processing - Constant Folding and Expression Simplification
+ Constant folding
```
SELECT id, name FROM emp WHERE age > ~!@18 + 6@!~;  -->  SELECT id, name FROM emp WHERE age > 24;
```

+ Expression simplification
```
SELECT id, name FROM emp WHERE ~!@id IS NOT NULL@!~ AND id < 1002;  -->  SELECT id, name FROM emp WHERE id < 1002;
```
------------------------------------------------------------------------------
The remaining two steps in the Pre-Processing stage are constant folding and expression simplification.

Constant folding involves evaluating expressions with constants within the SQL statement and storing the resulting values in the execution plan. For example, `SELECT id, name FROM emp WHERE age > 18 + 6;` is transformed into `SELECT id, name FROM emp WHERE age > 24;`.

Expression simplification is the logical optimization of predicate statements. For example, `SELECT id, name FROM emp WHERE id IS NOT NULL AND id < 1002;` is simplified to `SELECT id, name FROM emp WHERE id < 1002;`.