# SQL SIGN() Function: Complete Guide

SQL SIGN() function returns the sign of a number.

## SQL SIGN()

SQL SIGN() is a built-in function used for returning the sign of the number. It indicates whether the number is positive or negative by returning the following result: –

1. 1 if the number is positive i.e., number>0
2. -1 if the number is negative i.e., number<0
3. 0 is the number is zero i.e., number=0

### Syntax

```SELECT SIGN (number);
```

### Parameters

Number: The number which is used for testing its sign.

### Examples

#### Query 1

```Select Sign (-23);
```

`-1`

#### Explanation

As the number is less than 0. So, the sign of the number returned was -1.

#### Query 2

```Select Sign (0);
```

```0
```

#### Explanation

As the number is equal to 0. So, the sign of the number was returned was 0.

#### Query 3

```Select Sign (1);
```

```1
```

#### Explanation

As the number is greater than 0. So, the sign of the number returned was 1.

#### Query 4

```Select Sign (0.1);
```

`1.0`

#### Explanation

As the number is greater than 0 and is in decimal format. The number returned is also in decimal format.

#### Query 5

``` Select Sign (40-50);
```

```-1
```

#### Explanation

Here, the arithmetic expression is executed in sign function which resulted in a number less than 0. So, the sign of the number is negative.

#### Query 6

`Select Sign (NULL);`

```NULL
```

#### Explanation

As the number NULL is given as an input to the function. So, NULL was returned as an output.

SQL SIN()

SQL SQRT()

SQL TAN()

SQL CEILING()

SQL FLOOR()

Categories SQL

This site uses Akismet to reduce spam. Learn how your comment data is processed.