Skip to content

Commit

Permalink
Update docs.
Browse files Browse the repository at this point in the history
  • Loading branch information
mithrandie committed Jun 22, 2017
1 parent 66a10e9 commit 243b420
Show file tree
Hide file tree
Showing 9 changed files with 1,156 additions and 225 deletions.
89 changes: 67 additions & 22 deletions docs/_posts/2006-01-02-aggregate-functions.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,80 +13,125 @@ If distinct option is specified, aggregate functions calculate only unique value

| name | description |
| :- | :- |
| [COUNT](#count) | Return the number of rows |
| [MAX](#max) | |
| [MIN](#min) | |
| [SUM](#sum) | |
| [AVG](#avg) | |
| [GROUP_CONCAT](#group_concat) | |
| [COUNT](#count) | Return the number of values |
| [MAX](#max) | Return the maximum value |
| [MIN](#min) | Return the minimum value |
| [SUM](#sum) | Return the sum of values |
| [AVG](#avg) | Return the average of values |
| [GROUP_CONCAT](#group_concat) | Return the concatenated string of values |

## Definitions

### COUNT
{: #count}

```
COUNT([DISTINCT] expr) return integer
COUNT([DISTINCT] expr)
```

Returns a number of non-null values of expr.
_expr_
: [value]({{ '/reference/value.html' | relative_url }})

_return_
: [integer]({{ '/reference/value.html#integer' | relative_url }})

Returns the number of non-null values of _expr_.

```
COUNT([DISTINCT] *) return integer
COUNT([DISTINCT] *)
```

Return the number of values of expr including null values.
_return_
: [integer]({{ '/reference/value.html#integer' | relative_url }})

Return the number of all values including null values.

### MAX
{: #max}

```
MAX([DISTINCT] expr) return value
MAX([DISTINCT] expr)
```

Returns the maximum value of non-null values of expr.
_expr_
: [value]({{ '/reference/value.html' | relative_url }})

_return_
: [value]({{ '/reference/value.html' | relative_url }})

Returns the maximum value of non-null values of _expr_.
If all values are null, return null.

### MIN
{: #min}

```
MIN([DISTINCT] expr) return value
MIN([DISTINCT] expr)
```

Returns the minimum value of non-null values of expr.
_expr_
: [value]({{ '/reference/value.html' | relative_url }})

_return_
: [value]({{ '/reference/value.html' | relative_url }})

Returns the minimum value of non-null values of _expr_.
If all values are null, return null.

### SUM
{: #sum}

```
SUM([DISTINCT] expr) return decimal
SUM([DISTINCT] expr)
```

Returns the sum of non-null values of expr.
_expr_
: [value]({{ '/reference/value.html' | relative_url }})

_return_
: [float]({{ '/reference/value.html#float' | relative_url }}) or [integer]({{ '/reference/value.html#integer' | relative_url }})

Returns the sum of non-null values of _expr_.
If all values are null, return null.

### AVG
{: #avg}

```
AVG([DISTINCT] expr) return decimal
AVG([DISTINCT] expr)
```

Returns the average of non-null values of expr.
_expr_
: [value]({{ '/reference/value.html' | relative_url }})

_return_
: [float]({{ '/reference/value.html#float' | relative_url }}) or [integer]({{ '/reference/value.html#integer' | relative_url }})

Returns the average of non-null values of _expr_.
If all values are null, return null.

### GROUP_CONCAT
{: #group_concat}

```
GROUP_CONCAT([DISTINCT] expr [order_by_clause] [SEPARATOR string]) return string
GROUP_CONCAT([DISTINCT] expr [order_by_clause] [SEPARATOR sep])
```

Return the string result with the concatenated non-null values of expr.
_expr_
: [value]({{ '/reference/value.html' | relative_url }})

_order_by_clause_
: [Order By Clause]({{ '/reference/select-query.html#order_by_clause' | relative_url }})

_sep_
: [string]({{ '/reference/value.html#string' | relative_url }})

_return_
: [string]({{ '/reference/value.html#string' | relative_url }})

Return the string result with the concatenated non-null values of _expr_.
If all values are null, return null.

Separator string is placed between values. Default separator string is empty string.
Separator string _sep_ is placed between values. Default separator string is empty string.

By using order by clause, you can sort values.
By using _order_by_clause_, you can sort values.
72 changes: 60 additions & 12 deletions docs/_posts/2006-01-02-cast-functions.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,53 +8,101 @@ category: reference

| name | description |
| :- | :- |
| [STRING](#string) | |
| [INTEGER](#integer) | |
| [FLOAT](#float) | |
| [BOOLEAN](#boolean) | |
| [TERNARY](#ternary) | |
| [DATETIME](#datetime) | |
| [STRING](#string) | Convert a value to a string |
| [INTEGER](#integer) | Convert a value to a integer |
| [FLOAT](#float) | Convert a value to a float |
| [BOOLEAN](#boolean) | Convert a value to a boolean |
| [TERNARY](#ternary) | Convert a value to a ternary |
| [DATETIME](#datetime) | Convert a value to a datetime |

## Definitions

### STRING
{: #string}

```
STRING(value) return string
STRING(value)
```

_value_
: [value]({{ '/reference/value.html' | relative_url }})

_return_
: [string]({{ '/reference/value.html#string' | relative_url }})

Convert a value to a string.

### INTEGER
{: #integer}

```
INTEGER(value) return integer
INTEGER(value)
```

_value_
: [value]({{ '/reference/value.html' | relative_url }})

_return_
: [integer]({{ '/reference/value.html#integer' | relative_url }})

Convert a value to a integer.

### FLOAT
{: #float}

```
FLOAT(value) return float
FLOAT(value)
```

_value_
: [value]({{ '/reference/value.html' | relative_url }})

_return_
: [float]({{ '/reference/value.html#float' | relative_url }})

Convert a value to a float.

### BOOLEAN
{: #boolean}

```
BOOLEAN(value) return boolean
BOOLEAN(value)
```

_value_
: [value]({{ '/reference/value.html' | relative_url }})

_boolean_
: [boolean]({{ '/reference/value.html#boolean' | relative_url }})

Convert a value to a boolean.

### TERNARY
{: #ternary}

```
TERNARY(value) return ternary
TERNARY(value)
```

_value_
: [value]({{ '/reference/value.html' | relative_url }})

_return_
: [ternary]({{ '/reference/value.html#ternary' | relative_url }})

Convert a value to a ternary.

### DATETIME
{: #datetime}

```
DATETIME(value) return datetime
DATETIME(value)
```

_value_
: [value]({{ '/reference/value.html' | relative_url }})

_return_
: [datetime]({{ '/reference/value.html#datetime' | relative_url }})

Convert a value to a datetime.
2 changes: 1 addition & 1 deletion docs/_posts/2006-01-02-control-flow.md
Original file line number Diff line number Diff line change
Expand Up @@ -97,4 +97,4 @@ A Break statement stops statements execution in loop, then exit from current loo
EXIT;
```

A Exit statement stops statements execution, then terminates current program without commit.
A Exit statement stops statements execution, then terminates the executing procedure without commit.
Loading

0 comments on commit 243b420

Please sign in to comment.