# Using Functions

+ Function can be used anywhere that accepts an expression
+ Columns can be used as input parameters
+ The output of one function can be used as input to another function
+ Math function return **`NULL`** value in case of error (default behavior)
  + For example, divided by zero:
    + In **`ERROR_FOR_DIVISION_BY_ZERO`** `SQL` mode, a `DML` statement error is reported when attempting to proceed with its return value
      + **_`ERROR 1365 (22012): Division by 0`_**  

------------------------------------------------------------

The following error occurred because the math operation violated the `ERROR_FOR_DIVISION_BY_ZERO` SQL mode:

```
tidb> desc test.dropme;
+-------+---------+------+------+---------+-------+
| Field | Type    | Null | Key  | Default | Extra |
+-------+---------+------+------+---------+-------+
| id    | int(11) | YES  |      | NULL    |       |
+-------+---------+------+------+---------+-------+
1 row in set (0.00 sec)

tidb> SELECT 8/0;
+------+
| 8/0  |
+------+
| NULL |
+------+
1 row in set, 1 warning (0.01 sec)

tidb> INSERT INTO test.dropme (8/0);
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your TiDB version for the right syntax to use line 1 column 26 near "8/0)" 
tidb> SELECT @@SQL_MODE;
+-------------------------------------------------------------------------------------------------------------------------------------------+
| @@SQL_MODE                                                                                                                                |
+-------------------------------------------------------------------------------------------------------------------------------------------+
| ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION |
+-------------------------------------------------------------------------------------------------------------------------------------------+
1 row in set (0.00 sec)
```
