diff --git a/docs/_posts/2006-01-02-aggregate-functions.md b/docs/_posts/2006-01-02-aggregate-functions.md index feda7555..365f268d 100644 --- a/docs/_posts/2006-01-02-aggregate-functions.md +++ b/docs/_posts/2006-01-02-aggregate-functions.md @@ -13,12 +13,12 @@ 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 @@ -26,67 +26,112 @@ If distinct option is specified, aggregate functions calculate only unique value {: #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. \ No newline at end of file +By using _order_by_clause_, you can sort values. \ No newline at end of file diff --git a/docs/_posts/2006-01-02-cast-functions.md b/docs/_posts/2006-01-02-cast-functions.md index 25463b1f..20aac0fa 100644 --- a/docs/_posts/2006-01-02-cast-functions.md +++ b/docs/_posts/2006-01-02-cast-functions.md @@ -8,12 +8,12 @@ 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 @@ -21,40 +21,88 @@ category: reference {: #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. diff --git a/docs/_posts/2006-01-02-control-flow.md b/docs/_posts/2006-01-02-control-flow.md index 61919ee1..8bc7658d 100644 --- a/docs/_posts/2006-01-02-control-flow.md +++ b/docs/_posts/2006-01-02-control-flow.md @@ -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. \ No newline at end of file +A Exit statement stops statements execution, then terminates the executing procedure without commit. \ No newline at end of file diff --git a/docs/_posts/2006-01-02-cryptographic-hash-functions.md b/docs/_posts/2006-01-02-cryptographic-hash-functions.md index e6588b6c..efc65416 100644 --- a/docs/_posts/2006-01-02-cryptographic-hash-functions.md +++ b/docs/_posts/2006-01-02-cryptographic-hash-functions.md @@ -8,14 +8,14 @@ category: reference | name | description | | :- | :- | -| [MD5](#md5) | | -| [SHA1](#sha1) | | -| [SHA256](#sha256) | | -| [SHA512](#sha512) | | -| [MD5_HMAC](#md5_hmac) | | -| [SHA1_HMAC](#sha1_hmac) | | -| [SHA256_HMAC](#sha256_hmac) | | -| [SHA512_HMAC](#sha512_hmac) | | +| [MD5](#md5) | Generate a MD5 hash value | +| [SHA1](#sha1) | Generate a SHA-1 hash value | +| [SHA256](#sha256) | Generate a SHA-256 hash value | +| [SHA512](#sha512) | Generate a SHA-512 hash value | +| [MD5_HMAC](#md5_hmac) | Generate a MD5 keyed-hash value | +| [SHA1_HMAC](#sha1_hmac) | Generate a SHA-1 keyed-hash value | +| [SHA256_HMAC](#sha256_hmac) | Generate a SHA-256 keyed-hash value | +| [SHA512_HMAC](#sha512_hmac) | Generate a SHA-512 keyed-hash value | ## Definitions @@ -23,54 +23,130 @@ category: reference {: #md5} ``` -MD5(str string) return string +MD5(data) ``` +_data_ +: [string]({{ '/reference/value.html#string' | relative_url }}) + +_return_ +: [string]({{ '/reference/value.html#string' | relative_url }}) + +Generate a MD5 hash value. + ### SHA1 {: #sha1} ``` -SHA1(str string) return string +SHA1(data) ``` +_data_ +: [string]({{ '/reference/value.html#string' | relative_url }}) + +_return_ +: [string]({{ '/reference/value.html#string' | relative_url }}) + +Generate a SHA-1 hash value. + ### SHA256 {: #sha256} ``` -SHA256(str string) return string +SHA256(data) ``` +_data_ +: [string]({{ '/reference/value.html#string' | relative_url }}) + +_return_ +: [string]({{ '/reference/value.html#string' | relative_url }}) + +Generate a SHA-256 hash value. + ### SHA512 {: #sha512} ``` -SHA512(str string) return string +SHA512(data) ``` +_data_ +: [string]({{ '/reference/value.html#string' | relative_url }}) + +_return_ +: [string]({{ '/reference/value.html#string' | relative_url }}) + +Generate a SHA-512 hash value. + ### MD5_HMAC {: #md5_hmac} ``` -MD5_HMAC(str string, key string) return string +MD5_HMAC(data, key) ``` +_data_ +: [string]({{ '/reference/value.html#string' | relative_url }}) + +_key_ +: [string]({{ '/reference/value.html#string' | relative_url }}) + +_return_ +: [string]({{ '/reference/value.html#string' | relative_url }}) + +Generate a MD5 keyed-hash value using the HMAC method. + ### SHA1_HMAC {: #sha1_hmac} ``` -SHA1_HMAC(str string, key string) return string +SHA1_HMAC(data, key) ``` +_data_ +: [string]({{ '/reference/value.html#string' | relative_url }}) + +_key_ +: [string]({{ '/reference/value.html#string' | relative_url }}) + +_return_ +: [string]({{ '/reference/value.html#string' | relative_url }}) + +Generate a SHA-1 keyed-hash value using the HMAC method. + ### SHA256_HMAC {: #sha256_hmac} ``` -SHA256_HMAC(str string, key string) return string +SHA256_HMAC(data, key) ``` +_data_ +: [string]({{ '/reference/value.html#string' | relative_url }}) + +_key_ +: [string]({{ '/reference/value.html#string' | relative_url }}) + +_return_ +: [string]({{ '/reference/value.html#string' | relative_url }}) + +Generate a SHA-256 keyed-hash value using the HMAC method. + ### SHA512_HMAC {: #sha512_hmac} ``` -SHA512_HMAC(str string, key string) return string +SHA512_HMAC(str, key) ``` + +_data_ +: [string]({{ '/reference/value.html#string' | relative_url }}) + +_key_ +: [string]({{ '/reference/value.html#string' | relative_url }}) + +_return_ +: [string]({{ '/reference/value.html#string' | relative_url }}) + +Generate a SHA-512 keyed-hash value using the HMAC method. diff --git a/docs/_posts/2006-01-02-datetime-functions.md b/docs/_posts/2006-01-02-datetime-functions.md index 9042ca86..97d90a50 100644 --- a/docs/_posts/2006-01-02-datetime-functions.md +++ b/docs/_posts/2006-01-02-datetime-functions.md @@ -8,33 +8,33 @@ category: reference | name | description | | :- | :- | -| [NOW](#now) | | -| [DATETIME_FORMAT](#datetime_format) | | -| [YEAR](#year) | | -| [MONTH](#month) | | -| [DAY](#day) | | -| [HOUR](#hour) | | -| [MINUTE](#minute) | | -| [SECOND](#second) | | -| [MILLISECOND](#millisecond) | | -| [MICROSECOND](#microsecond) | | -| [NANOSECOND](#nanosecond) | | -| [WEEKDAY](#weekday) | | -| [UNIX_TIME](#unix_time) | | -| [UNIX_NANO_TIME](#unix_nano_time) | | -| [DAY_OF_YEAR](#day_of_year) | | -| [WEEK_OF_YEAR](#week_of_year) | | -| [ADD_YEAR](#add_year) | | -| [ADD_MONTH](#add_month) | | -| [ADD_DAY](#add_day) | | -| [ADD_HOUR](#add_hour) | | -| [ADD_MINUTE](#add_minute) | | -| [ADD_SECOND](#add_second) | | -| [ADD_MILLI](#add_milli) | | -| [ADD_MICRO](#add_micro) | | -| [ADD_NANO](#add_nano) | | -| [DATE_DIFF](#date_diff) | | -| [TIME_DIFF](#time_diff) | | +| [NOW](#now) | Return current date and time | +| [DATETIME_FORMAT](#datetime_format) | Format a datetime | +| [YEAR](#year) | Return year of a datetime | +| [MONTH](#month) | Return month of a datetime | +| [DAY](#day) | Return day of a datetime | +| [HOUR](#hour) | Return hour of a datetime | +| [MINUTE](#minute) | Return minute of a datetime | +| [SECOND](#second) | Return second of a datetime | +| [MILLISECOND](#millisecond) | Return millisecond of a datetime | +| [MICROSECOND](#microsecond) | Return microsecond of a datetime | +| [NANOSECOND](#nanosecond) | Return nanosecond of a datetime | +| [WEEKDAY](#weekday) | Return weekday number of a datetime | +| [UNIX_TIME](#unix_time) | Return Unix time of a datetime | +| [UNIX_NANO_TIME](#unix_nano_time) | Return Unix nano time of a datetime | +| [DAY_OF_YEAR](#day_of_year) | Return day of year of a datetime | +| [WEEK_OF_YEAR](#week_of_year) | Return week number of year of a datetime | +| [ADD_YEAR](#add_year) | Add years to a datetime | +| [ADD_MONTH](#add_month) | Add monthes to a datetime | +| [ADD_DAY](#add_day) | Add days to a datetime | +| [ADD_HOUR](#add_hour) | Add hours to a datetime | +| [ADD_MINUTE](#add_minute) | Add minutes to a datetime | +| [ADD_SECOND](#add_second) | Add seconds to a datetime | +| [ADD_MILLI](#add_milli) | Add milliseconds to a datetime | +| [ADD_MICRO](#add_micro) | Add microseconds to a datetime | +| [ADD_NANO](#add_nano) | Add nanoseconds to a datetime | +| [DATE_DIFF](#date_diff) | Return the difference of days between two datetime values | +| [TIME_DIFF](#time_diff) | Return the difference of time between two datetime values | ## Definitions @@ -42,187 +42,484 @@ category: reference {: #now} ``` -NOW() return datetime +NOW() ``` +_return_ +: [datetime]({{ '/reference/value.html#datetime' | relative_url }}) + +Return current date and time. + ### DATETIME_FORMAT {: #datetime_format} ``` -DATETIME_FORMAT(dt datetime, format string) return string +DATETIME_FORMAT(datetime, format) ``` +_datetime_ +: [datetime]({{ '/reference/value.html#datetime' | relative_url }}) + +_format_ +: [string]({{ '/reference/value.html#string' | relative_url }}) + +_return_ +: [string]({{ '/reference/value.html#string' | relative_url }}) + +Format the _datetime_ according to the string _format_. + +#### Format Placeholders + +| placeholder | description | +| :- | :- | +| %a | Abbreviation of week name (Sun, Mon, ...) | +| %b | Abbreviation of month name (Jan, Feb, ...) | +| %c | Month number (0 - 12) | +| %d | Day of month in two digits (01 - 31) | +| %E | Day of month padding with a underscore (_1 - 31) | +| %e | Day of month (1 - 31) | +| %F | Microseconds that drops trailing zeros (empty - .999999) | +| %f | Microseconds (.000000 - .999999) | +| %H | Hour in 24-hour (00 - 23) | +| %h | Hour in two digits 12-hour (01 - 12) | +| %i | Minute in two digits (00 - 59) | +| %l | Hour in 12-hour (1 - 12) | +| %M | Month name (January, February, ...) | +| %m | Month number with two digits (01 - 12) | +| %N | Nanoseconds that drops trailing zeros (empty - .999999999) | +| %n | Nanoseconds (.000000000 - .999999999) | +| %p | Period in a day (AM or PM) | +| %r | Time with a period (%H:%i:%s %p) | +| %s | Second in two digits (00 - 59) | +| %T | Time (%H:%i:%s) | +| %W | Week name (Sunday, Monday, ...) | +| %Y | Year in four digits | +| %y | Year in two digits | +| %Z | Time zone in time difference | +| %z | Abbreviation of Time zone name | + +> You can also use [the Time Layout of the Go Lang](https://golang.org/pkg/time/#Time.Format) as a format. + ### YEAR {: #year} ``` -YEAR(dt datetime) return integer +YEAR(datetime) ``` +_datetime_ +: [datetime]({{ '/reference/value.html#datetime' | relative_url }}) + +_return_ +: [integer]({{ '/reference/value.html#integer' | relative_url }}) + +Return year of the _datetime_ as integer. + ### MONTH {: #month} ``` -MONTH(dt datetime) return integer +MONTH(datetime) ``` +_datetime_ +: [datetime]({{ '/reference/value.html#datetime' | relative_url }}) + +_return_ +: [integer]({{ '/reference/value.html#integer' | relative_url }}) + +Return month number of the _datetime_ as integer. + ### DAY {: #day} ``` -DAY(dt datetime) return integer +DAY(datetime) ``` +_datetime_ +: [datetime]({{ '/reference/value.html#datetime' | relative_url }}) + +_return_ +: [integer]({{ '/reference/value.html#integer' | relative_url }}) + +Return day of month of the _datetime_ as integer. + ### HOUR {: #hour} ``` -HOUR(dt datetime) return integer +HOUR(datetime) ``` +_datetime_ +: [datetime]({{ '/reference/value.html#datetime' | relative_url }}) + +_return_ +: [integer]({{ '/reference/value.html#integer' | relative_url }}) + +Return hour of the _datetime_ as integer. + ### MINUTE {: #minute} ``` -MINUTE(dt datetime) return integer +MINUTE(datetime) ``` +_datetime_ +: [datetime]({{ '/reference/value.html#datetime' | relative_url }}) + +_return_ +: [integer]({{ '/reference/value.html#integer' | relative_url }}) + +Return minute of the _datetime_ as integer. + ### SECOND {: #second} ``` -SECOND(dt datetime) return integer +SECOND(datetime) ``` +_datetime_ +: [datetime]({{ '/reference/value.html#datetime' | relative_url }}) + +_return_ +: [integer]({{ '/reference/value.html#integer' | relative_url }}) + +Return seconds of the _datetime_ as integer. + ### MILLISECOND {: #millisecond} ``` -MILLISECOND(dt datetime) return integer +MILLISECOND(datetime) ``` +_datetime_ +: [datetime]({{ '/reference/value.html#datetime' | relative_url }}) + +_return_ +: [integer]({{ '/reference/value.html#integer' | relative_url }}) + +Return millisecond of the _datetime_ as integer. + ### MICROSECOND {: #microsecond} ``` -MICROSECOND(dt datetime) return integer +MICROSECOND(datetime) ``` +_datetime_ +: [datetime]({{ '/reference/value.html#datetime' | relative_url }}) + +_return_ +: [integer]({{ '/reference/value.html#integer' | relative_url }}) + +Return microsecond of the _datetime_ as integer. + ### NANOSECOND {: #nanosecond} ``` -NANOSECOND(dt datetime) return integer +NANOSECOND(datetime) ``` +_datetime_ +: [datetime]({{ '/reference/value.html#datetime' | relative_url }}) + +_return_ +: [integer]({{ '/reference/value.html#integer' | relative_url }}) + +Return nanosecond of the _datetime_ as integer. + ### WEEKDAY {: #weekday} ``` -WEEKDAY(dt datetime) return integer +WEEKDAY(datetime) ``` +_datetime_ +: [datetime]({{ '/reference/value.html#datetime' | relative_url }}) + +_return_ +: [integer]({{ '/reference/value.html#integer' | relative_url }}) + +Return weekday number of the _datetime_ as integer. + +#### Weekday number + +| weekday | number | +| :- | :- | +| Sunday | 0 | +| Monday | 1 | +| Tuesday | 2 | +| Wednesday | 3 | +| Thursday | 4 | +| Friday | 5 | +| Saturday | 6 | + ### UNIX_TIME {: #unix_time} ``` -UNIX_TIME(dt datetime) return integer +UNIX_TIME(datetime) ``` +_datetime_ +: [datetime]({{ '/reference/value.html#datetime' | relative_url }}) + +_return_ +: [integer]({{ '/reference/value.html#integer' | relative_url }}) + +Return the number of seconds elapsed since January 1, 1970 UTC of the _datetime_ as integer. + ### UNIX_NANO_TIME {: #unix_nano_time} ``` -UNIX_NANO_TIME(dt datetime) return integer +UNIX_NANO_TIME(datetime) ``` +_datetime_ +: [datetime]({{ '/reference/value.html#datetime' | relative_url }}) + +_return_ +: [integer]({{ '/reference/value.html#integer' | relative_url }}) + +Return the number of nanoseconds elapsed since January 1, 1970 UTC of the _datetime_ as integer. + ### DAY_OF_YEAR {: #day_of_year} ``` -DAY_OF_YEAR(dt datetime) return integer +DAY_OF_YEAR(datetime) ``` +_datetime_ +: [datetime]({{ '/reference/value.html#datetime' | relative_url }}) + +_return_ +: [integer]({{ '/reference/value.html#integer' | relative_url }}) + +Return day of year of the _datetime_ as integer. + ### WEEK_OF_YEAR {: #week_of_year} ``` -WEEK_OF_YEAR(dt datetime) return integer +WEEK_OF_YEAR(datetime) ``` +_datetime_ +: [datetime]({{ '/reference/value.html#datetime' | relative_url }}) + +_return_ +: [integer]({{ '/reference/value.html#integer' | relative_url }}) + +Return week number of year of the _datetime_ as integer. +The week number is in the range from 1 to 53. +Jan 01 to Jan 03 of year might return week 52 or 53 of the last year, and Dec 29 to Dec 31 might return week 1 of next year. + ### ADD_YEAR {: #add_year} ``` -ADD_YEAR(dt datetime, duration int) return datetime +ADD_YEAR(datetime, duration) ``` +_datetime_ +: [datetime]({{ '/reference/value.html#datetime' | relative_url }}) + +_duration_ +: [integer]({{ '/reference/value.html#integer' | relative_url }}) + +_return_ +: [datetime]({{ '/reference/value.html#datetime' | relative_url }}) + +Add _duration_ years to the _datetime_. + ### ADD_MONTH {: #add_month} ``` -ADD_MONTH(dt datetime, duration int) return datetime +ADD_MONTH(datetime, duration) ``` +_datetime_ +: [datetime]({{ '/reference/value.html#datetime' | relative_url }}) + +_duration_ +: [integer]({{ '/reference/value.html#integer' | relative_url }}) + +_return_ +: [datetime]({{ '/reference/value.html#datetime' | relative_url }}) + +Add _duration_ monthes to the _datetime_. + ### ADD_DAY {: #add_day} ``` -ADD_DAY(dt datetime, duration int) return datetime +ADD_DAY(datetime, duration) ``` +_datetime_ +: [datetime]({{ '/reference/value.html#datetime' | relative_url }}) + +_duration_ +: [integer]({{ '/reference/value.html#integer' | relative_url }}) + +_return_ +: [datetime]({{ '/reference/value.html#datetime' | relative_url }}) + +Add _duration_ days to the _datetime_. + ### ADD_HOUR {: #add_hour} ``` -ADD_HOUR(dt datetime, duration int) return datetime +ADD_HOUR(datetime, duration) ``` +_datetime_ +: [datetime]({{ '/reference/value.html#datetime' | relative_url }}) + +_duration_ +: [integer]({{ '/reference/value.html#integer' | relative_url }}) + +_return_ +: [datetime]({{ '/reference/value.html#datetime' | relative_url }}) + +Add _duration_ hours to the _datetime_. + ### ADD_MINUTE {: #add_minute} ``` -ADD_MINUTE(dt datetime, duration int) return datetime +ADD_MINUTE(datetime, duration) ``` +_datetime_ +: [datetime]({{ '/reference/value.html#datetime' | relative_url }}) + +_duration_ +: [integer]({{ '/reference/value.html#integer' | relative_url }}) + +_return_ +: [datetime]({{ '/reference/value.html#datetime' | relative_url }}) + +Add _duration_ minutes to the _datetime_. + ### ADD_SECOND {: #add_second} ``` -ADD_SECOND(dt datetime, duration int) return datetime +ADD_SECOND(datetime, duration) ``` +_datetime_ +: [datetime]({{ '/reference/value.html#datetime' | relative_url }}) + +_duration_ +: [integer]({{ '/reference/value.html#integer' | relative_url }}) + +_return_ +: [datetime]({{ '/reference/value.html#datetime' | relative_url }}) + +Add _duration_ seconds to the _datetime_. + ### ADD_MILLI {: #add_milli} ``` -ADD_MILLI(dt datetime, duration int) return datetime +ADD_MILLI(datetime, duration) ``` +_datetime_ +: [datetime]({{ '/reference/value.html#datetime' | relative_url }}) + +_duration_ +: [integer]({{ '/reference/value.html#integer' | relative_url }}) + +_return_ +: [datetime]({{ '/reference/value.html#datetime' | relative_url }}) + +Add _duration_ milliseconds to the _datetime_. + ### ADD_MICRO {: #add_micro} ``` -ADD_MICRO(dt datetime, duration int) return datetime +ADD_MICRO(datetime, duration) ``` +_datetime_ +: [datetime]({{ '/reference/value.html#datetime' | relative_url }}) + +_duration_ +: [integer]({{ '/reference/value.html#integer' | relative_url }}) + +_return_ +: [datetime]({{ '/reference/value.html#datetime' | relative_url }}) + +Add _duration_ microseconds to the _datetime_. + ### ADD_NANO {: #add_nano} ``` -ADD_NANO(dt datetime, duration int) return datetime +ADD_NANO(datetime, duration) ``` +_datetime_ +: [datetime]({{ '/reference/value.html#datetime' | relative_url }}) + +_duration_ +: [integer]({{ '/reference/value.html#integer' | relative_url }}) + +_return_ +: [datetime]({{ '/reference/value.html#datetime' | relative_url }}) + +Add _duration_ nanoseconds to the _datetime_. + ### DATE_DIFF {: #date_diff} ``` -DATE_DIFF(dt1 datetime, dt2 datetime) return integer +DATE_DIFF(datetime1, datetime2) ``` +_datetime1_ +: [datetime]({{ '/reference/value.html#datetime' | relative_url }}) + +_duration2_ +: [datetime]({{ '/reference/value.html#datetime' | relative_url }}) + +_return_ +: [integer]({{ '/reference/value.html#integer' | relative_url }}) + +Return the difference of days between two _datetime_ values. +The time parts are ignored in the calculation. + ### TIME_DIFF {: #time_diff} ``` -TIME_DIFF(dt1 datetime, dt2 datetime) return float +TIME_DIFF(datetime1, datetime2) ``` + +_datetime1_ +: [datetime]({{ '/reference/value.html#datetime' | relative_url }}) + +_duration2_ +: [datetime]({{ '/reference/value.html#datetime' | relative_url }}) + +_return_ +: [float]({{ '/reference/value.html#float' | relative_url }}) + +Return the difference of time between two _datetime_ values. +In the return value, the integer part representing seconds and the fractional part representing nanoseconds. \ No newline at end of file diff --git a/docs/_posts/2006-01-02-logical-functions.md b/docs/_posts/2006-01-02-logical-functions.md index 8cb255e1..90f5bffc 100644 --- a/docs/_posts/2006-01-02-logical-functions.md +++ b/docs/_posts/2006-01-02-logical-functions.md @@ -12,7 +12,6 @@ category: reference | [IF](#if) | Return a value by condition | | [IFNULL](#ifnull) | Return a value whether passed value is null | | [NULLIF](#nullif) | Return null wheter passed values are equal | -| [CASE](#case) | | ## Definitions @@ -20,45 +19,71 @@ category: reference {: #coalesce} ``` -COALESCE(value, ...) return value +COALESCE(value [, value ...]) ``` -Return the first non-null value in arguments. If there are no non-null value, return null. +_value_ +: [value]({{ '/reference/value.html' | relative_url }}) + +_return_ +: [primitive type]({{ '/reference/value.html#primitive_types' | relative_url }}) + +Return the first non-null _value_ in arguments. If there are no non-null _value_, return null. ### IF {: #if} ``` -IF(condition, value1, value2) return value +IF(condition, value1, value2) ``` -If condition is TRUE, returns value1. Otherwise returns value2. +_condition_ +: [value]({{ '/reference/value.html' | relative_url }}) + +_value1_ +: [value]({{ '/reference/value.html' | relative_url }}) + +_value2_ +: [value]({{ '/reference/value.html' | relative_url }}) + +_return_ +: [primitive type]({{ '/reference/value.html#primitive_types' | relative_url }}) + +If _condition_ is TRUE, returns _value1_. Otherwise returns _value2_. ### IFNULL {: #ifnull} ``` -IFNULL(value1, value2) return value +IFNULL(value1, value2) ``` -If value1 is null, return value2. Otherwise return value1. +_value1_ +: [value]({{ '/reference/value.html' | relative_url }}) + +_value2_ +: [value]({{ '/reference/value.html' | relative_url }}) + +_return_ +: [primitive type]({{ '/reference/value.html#primitive_types' | relative_url }}) + +If _value1_ is null, return _value2_. Otherwise return _value1_. ### NULLIF {: #nullif} ``` -NULLIF(value1, value2) return value +NULLIF(value1, value2) ``` -If value1 is equal to value2, return null. Otherwise return value1. +_value1_ +: [value]({{ '/reference/value.html' | relative_url }}) -### CASE -{: #case} +_value2_ +: [value]({{ '/reference/value.html' | relative_url }}) -``` -CASE value WHEN value THEN value [WHEN value THE value ...] [ELSE value] END -``` +_return_ +: [primitive type]({{ '/reference/value.html#primitive_types' | relative_url }}) + +If _value1_ is equal to _value2_, return null. Otherwise return _value1_. -``` -CASE WHEN condition THEN value [WHEN condition THE value ...] [ELSE value] END -``` \ No newline at end of file diff --git a/docs/_posts/2006-01-02-numeric-functions.md b/docs/_posts/2006-01-02-numeric-functions.md index 308f2985..e3ede60d 100644 --- a/docs/_posts/2006-01-02-numeric-functions.md +++ b/docs/_posts/2006-01-02-numeric-functions.md @@ -8,33 +8,35 @@ category: reference | name | description | | :- | :- | -| [CEIL](#ceil) | | -| [FLOOR](#floor) | | -| [ROUND](#round) | | -| [ABS](#abs) | | -| [ACOS](#acos) | | -| [ASIN](#asin) | | -| [ATAN](#atan) | | -| [ATAN2](#atan2) | | -| [COS](#cos) | | -| [SIN](#sin) | | -| [TAN](#tan) | | -| [EXP](#exp) | | -| [EXP2](#exp2) | | -| [EXPM1](#expm1) | | -| [LOG](#log) | | -| [LOG10](#log10) | | -| [LOG2](#log2) | | -| [LOG1P](#log1p) | | -| [SQRT](#sqrt) | | -| [POW](#pow) | | -| [BIN_TO_DEC](#bin_to_dec) | | -| [OCT_TO_DEC](#oct_to_dec) | | -| [HEX_TO_DEC](#hex_to_dec) | | -| [BIN](#bin) | | -| [OCT](#oct) | | -| [HEX](#hex) | | -| [RAND](#rand) | | +| [CEIL](#ceil) | Round a number up | +| [FLOOR](#floor) | Round a number down | +| [ROUND](#round) | Round a number | +| [ABS](#abs) | Return the absolute value of a number | +| [ACOS](#acos) | Return the arc cosine of a number | +| [ASIN](#asin) | Return the arc sine of a number | +| [ATAN](#atan) | Return the arc tangent of a number | +| [ATAN2](#atan2) | Return the arc tangent of two numbers | +| [COS](#cos) | Return the cosine of a number | +| [SIN](#sin) | Return the sine of a number | +| [TAN](#tan) | Return the tangent of a number | +| [EXP](#exp) | Return the value of base _e_ raised to the power of a number | +| [EXP2](#exp2) | Return the value of base _2_ raised to the power of a number | +| [EXPM1](#expm1) | Return the value of base _e_ rised to the power of a number minus 1 | +| [LOG](#log) | Return the natural logarithm of a number | +| [LOG10](#log10) | Return the decimal logarithm of a number | +| [LOG2](#log2) | Return the binary logarithm of a number | +| [LOG1P](#log1p) | Return the natural logarithm of 1 plus a number | +| [SQRT](#sqrt) | Return the square root of a number | +| [POW](#pow) | Returns the value of a number raised to the power of another number | +| [BIN_TO_DEC](#bin_to_dec) | Convert a string representing a binary number to a integer | +| [OCT_TO_DEC](#oct_to_dec) | Convert a string representing a octal number to a integer | +| [HEX_TO_DEC](#hex_to_dec) | Convert a string representing a hexadecimal number to a integer | +| [BIN](#bin) | Convert a integer to a string representing a bynary number | +| [OCT](#oct) | Convert a integer to a string representing a octal number | +| [HEX](#hex) | Convert a integer to a string representing a hexadecimal number | +| [RAND](#rand) | Return a pseudo-random number | + +> _e_ is the base of natural logarithms ## Definitions @@ -42,203 +44,469 @@ category: reference {: #ceil} ``` -CEIL(dec decimal) return decimal +CEIL(number) ``` +_number_ +: [float]({{ '/reference/value.html#float' | relative_url }}) or [integer]({{ '/reference/value.html#integer' | relative_url }}) + +_return_ +: [float]({{ '/reference/value.html#float' | relative_url }}) or [integer]({{ '/reference/value.html#integer' | relative_url }}) + +Round _number_ up to an integer value. + ``` -CEIL(dec decimal, pos integer) return decimal +CEIL(number, place) ``` +_number_ +: [float]({{ '/reference/value.html#float' | relative_url }}) or [integer]({{ '/reference/value.html#integer' | relative_url }}) + +_place_ +: [integer]({{ '/reference/value.html#integer' | relative_url }}) + +_return_ +: [float]({{ '/reference/value.html#float' | relative_url }}) or [integer]({{ '/reference/value.html#integer' | relative_url }}) + +Round _number_ up to _place_ decimal place. +If _place_ is negative number, _place_ representing a place in integer part, + ### FLOOR {: #floor} ``` -FLOOR(dec decimal) return decimal +FLOOR(number) ``` +_number_ +: [float]({{ '/reference/value.html#float' | relative_url }}) or [integer]({{ '/reference/value.html#integer' | relative_url }}) + +_return_ +: [float]({{ '/reference/value.html#float' | relative_url }}) or [integer]({{ '/reference/value.html#integer' | relative_url }}) + +Round _number_ down to an integer value. + ``` -FLOOR(dec decimal, pos integer) return decimal +FLOOR(number, place) ``` +_number_ +: [float]({{ '/reference/value.html#float' | relative_url }}) or [integer]({{ '/reference/value.html#integer' | relative_url }}) + +_place_ +: [integer]({{ '/reference/value.html#integer' | relative_url }}) + +_return_ +: [float]({{ '/reference/value.html#float' | relative_url }}) or [integer]({{ '/reference/value.html#integer' | relative_url }}) + +Round _number_ down to _place_ decimal place. +If _place_ is negative number, _place_ representing a place in integer part, + ### ROUND {: #round} ``` -ROUND(dec decimal) return decimal +ROUND(number) ``` +_number_ +: [float]({{ '/reference/value.html#float' | relative_url }}) or [integer]({{ '/reference/value.html#integer' | relative_url }}) + +_return_ +: [float]({{ '/reference/value.html#float' | relative_url }}) or [integer]({{ '/reference/value.html#integer' | relative_url }}) + +Round _number_ to an integer value. + ``` -ROUND(dec decimal, pos integer) return decimal +ROUND(number, place) ``` +_number_ +: [float]({{ '/reference/value.html#float' | relative_url }}) or [integer]({{ '/reference/value.html#integer' | relative_url }}) + +_place_ +: [integer]({{ '/reference/value.html#integer' | relative_url }}) + +_return_ +: [float]({{ '/reference/value.html#float' | relative_url }}) or [integer]({{ '/reference/value.html#integer' | relative_url }}) + +Round _number_ to _place_ decimal place. +If _place_ is negative number, _place_ representing a place in integer part, + ### ABS {: #abs} ``` -ABS(dec decimal) return decimal +ABS(number) ``` +_number_ +: [float]({{ '/reference/value.html#float' | relative_url }}) or [integer]({{ '/reference/value.html#integer' | relative_url }}) + +_return_ +: [float]({{ '/reference/value.html#float' | relative_url }}) or [integer]({{ '/reference/value.html#integer' | relative_url }}) + +Return the absolute value of _number_ + ### ACOS {: #acos} ``` -ACOS(dec decimal) return decimal +ACOS(number) ``` +_number_ +: [float]({{ '/reference/value.html#float' | relative_url }}) or [integer]({{ '/reference/value.html#integer' | relative_url }}) + +_return_ +: [float]({{ '/reference/value.html#float' | relative_url }}) or [integer]({{ '/reference/value.html#integer' | relative_url }}) + +Return the arc cosine of _number_. + ### ASIN {: #asin} ``` -ASIN(dec decimal) return decimal +ASIN(number) ``` +_number_ +: [float]({{ '/reference/value.html#float' | relative_url }}) or [integer]({{ '/reference/value.html#integer' | relative_url }}) + +_return_ +: [float]({{ '/reference/value.html#float' | relative_url }}) or [integer]({{ '/reference/value.html#integer' | relative_url }}) + +Return the arc sine of _number_. + ### ATAN {: #atan} ``` -ATAN(dec decimal) return decimal +ATAN(number) ``` +_number_ +: [float]({{ '/reference/value.html#float' | relative_url }}) or [integer]({{ '/reference/value.html#integer' | relative_url }}) + +_return_ +: [float]({{ '/reference/value.html#float' | relative_url }}) or [integer]({{ '/reference/value.html#integer' | relative_url }}) + +Return the arc tangent of _number_. + ### ATAN2 {: #atan2} ``` -ATAN2(dec decimal) return decimal +ATAN2(number2, number1) ``` +_number2_ +: [float]({{ '/reference/value.html#float' | relative_url }}) or [integer]({{ '/reference/value.html#integer' | relative_url }}) + +_number1_ +: [float]({{ '/reference/value.html#float' | relative_url }}) or [integer]({{ '/reference/value.html#integer' | relative_url }}) + +_return_ +: [float]({{ '/reference/value.html#float' | relative_url }}) or [integer]({{ '/reference/value.html#integer' | relative_url }}) + +Return the arc tangent of _number2_ / _number1_, using the signs of the two to determine the quadrant of the return value. + ### COS {: #cos} ``` -COS(dec decimal) return decimal +COS(number) ``` +_number_ +: [float]({{ '/reference/value.html#float' | relative_url }}) or [integer]({{ '/reference/value.html#integer' | relative_url }}) + +_return_ +: [float]({{ '/reference/value.html#float' | relative_url }}) or [integer]({{ '/reference/value.html#integer' | relative_url }}) + +Return the cosine of _number_. + ### SIN {: #sin} ``` -SIN(dec decimal) return decimal +SIN(number) ``` +_number_ +: [float]({{ '/reference/value.html#float' | relative_url }}) or [integer]({{ '/reference/value.html#integer' | relative_url }}) + +_return_ +: [float]({{ '/reference/value.html#float' | relative_url }}) or [integer]({{ '/reference/value.html#integer' | relative_url }}) + +Return the sine of _number_. + ### TAN {: #tan} ``` -TAN(dec decimal) return decimal +TAN(number) ``` +_number_ +: [float]({{ '/reference/value.html#float' | relative_url }}) or [integer]({{ '/reference/value.html#integer' | relative_url }}) + +_return_ +: [float]({{ '/reference/value.html#float' | relative_url }}) or [integer]({{ '/reference/value.html#integer' | relative_url }}) + +Return the tangent of _number_. + ### EXP {: #exp} ``` -EXP(dec decimal) return decimal +EXP(number) ``` +_number_ +: [float]({{ '/reference/value.html#float' | relative_url }}) or [integer]({{ '/reference/value.html#integer' | relative_url }}) + +_return_ +: [float]({{ '/reference/value.html#float' | relative_url }}) or [integer]({{ '/reference/value.html#integer' | relative_url }}) + +Return the value of base _e_ raised to the power of _number_. + ### EXP2 {: #exp2} ``` -EXP2(dec decimal) return decimal +EXP2(number) ``` +_number_ +: [float]({{ '/reference/value.html#float' | relative_url }}) or [integer]({{ '/reference/value.html#integer' | relative_url }}) + +_return_ +: [float]({{ '/reference/value.html#float' | relative_url }}) or [integer]({{ '/reference/value.html#integer' | relative_url }}) + +Return the value of base _2_ raised to the power of _number_. + ### EXPM1 {: #expm1} ``` -EXPM1(dec decimal) return decimal +EXPM1(number) ``` +_number_ +: [float]({{ '/reference/value.html#float' | relative_url }}) or [integer]({{ '/reference/value.html#integer' | relative_url }}) + +_return_ +: [float]({{ '/reference/value.html#float' | relative_url }}) or [integer]({{ '/reference/value.html#integer' | relative_url }}) + +Return the value of base _e_ rised to the power of _number_ minus 1. + ### LOG {: #log} ``` -LOG(dec decimal) return decimal +LOG(number) ``` +_number_ +: [float]({{ '/reference/value.html#float' | relative_url }}) or [integer]({{ '/reference/value.html#integer' | relative_url }}) + +_return_ +: [float]({{ '/reference/value.html#float' | relative_url }}) or [integer]({{ '/reference/value.html#integer' | relative_url }}) + +Return the natural logarithm of _number_. + ### LOG10 {: #log10} ``` -LOG10(dec decimal) return decimal +LOG10(number) ``` +_number_ +: [float]({{ '/reference/value.html#float' | relative_url }}) or [integer]({{ '/reference/value.html#integer' | relative_url }}) + +_return_ +: [float]({{ '/reference/value.html#float' | relative_url }}) or [integer]({{ '/reference/value.html#integer' | relative_url }}) + +Return the decimal logarithm of _number_. + ### LOG2 {: #log2} ``` -LOG1(dec decimal) return decimal +LOG2(number) ``` +_number_ +: [float]({{ '/reference/value.html#float' | relative_url }}) or [integer]({{ '/reference/value.html#integer' | relative_url }}) + +_return_ +: [float]({{ '/reference/value.html#float' | relative_url }}) or [integer]({{ '/reference/value.html#integer' | relative_url }}) + +Return the binary logarithm of _number_. + ### LOG1P {: #log1p} ``` -LOG1P(dec decimal) return decimal +LOG1P(number) ``` +_number_ +: [float]({{ '/reference/value.html#float' | relative_url }}) or [integer]({{ '/reference/value.html#integer' | relative_url }}) + +_return_ +: [float]({{ '/reference/value.html#float' | relative_url }}) or [integer]({{ '/reference/value.html#integer' | relative_url }}) + +Return the natural logarithm of 1 plus _number_. + ### SQRT {: #sqrt} ``` -SQRT(dec decimal) return decimal +SQRT(number) ``` +_number_ +: [float]({{ '/reference/value.html#float' | relative_url }}) or [integer]({{ '/reference/value.html#integer' | relative_url }}) + +_return_ +: [float]({{ '/reference/value.html#float' | relative_url }}) or [integer]({{ '/reference/value.html#integer' | relative_url }}) + +Return the square root of _number_. + ### POW {: #pow} ``` -POW(dec decimal, exponent decimal) return decimal +POW(base, exponent) ``` +_base_ +: [float]({{ '/reference/value.html#float' | relative_url }}) or [integer]({{ '/reference/value.html#integer' | relative_url }}) + +_exponent_ +: [float]({{ '/reference/value.html#float' | relative_url }}) or [integer]({{ '/reference/value.html#integer' | relative_url }}) + +_return_ +: [float]({{ '/reference/value.html#float' | relative_url }}) or [integer]({{ '/reference/value.html#integer' | relative_url }}) + +Returns the value of _base_ raised to the power of _exponent_. + ### BIN_TO_DEC {: #bin_to_dec} ``` -BIN_TO_DEC(bin string) return integer +BIN_TO_DEC(bin) ``` +_bin_ +: [string]({{ '/reference/value.html#string' | relative_url }}) + +_return_ +: [integer]({{ '/reference/value.html#integer' | relative_url }}) + +Convert a string _bin_ representing a binary number to a integer. + ### OCT_TO_DEC {: #oct_to_dec} ``` -BIN_TO_DEC(oct string) return integer +BIN_TO_DEC(oct) ``` +_oct_ +: [string]({{ '/reference/value.html#string' | relative_url }}) + +_return_ +: [integer]({{ '/reference/value.html#integer' | relative_url }}) + +Convert a string _hex_ representing a octal number to a integer. + ### HEX_TO_DEC {: #hex_to_dec} ``` -BIN_TO_DEC(hex string) return integer +BIN_TO_DEC(hex) ``` +_hex_ +: [string]({{ '/reference/value.html#string' | relative_url }}) + +_return_ +: [integer]({{ '/reference/value.html#integer' | relative_url }}) + +Convert a string _hex_ representing a hexadecimal number to a integer. + ### BIN {: #bin} ``` -BIN(i integer) return string +BIN(integer) ``` +_integer_ +: [integer]({{ '/reference/value.html#integer' | relative_url }}) + +_return_ +: [string]({{ '/reference/value.html#string' | relative_url }}) + +Convert a _integer_ to a string representing a binary number. + ### OCT {: #oct} ``` -OCT(i integer) return string +OCT(integer) ``` +_integer_ +: [integer]({{ '/reference/value.html#integer' | relative_url }}) + +_return_ +: [string]({{ '/reference/value.html#string' | relative_url }}) + +Convert a _integer_ to a string representing a octal number. + ### HEX {: #hex} ``` -HEX(i integer) return string +HEX(integer) ``` +_integer_ +: [integer]({{ '/reference/value.html#integer' | relative_url }}) + +_return_ +: [string]({{ '/reference/value.html#string' | relative_url }}) + +Convert a _integer_ to a string representing a hexadecimal number. + ### RAND {: #rand} ``` -RAND() return float +RAND() ``` +_return_ +: [float]({{ '/reference/value.html#float' | relative_url }}) + +Return a random float greater than or equal to 0.0 and less than 1.0. + ``` -RAND(low integer, high integer) return integer +RAND(min, max) ``` + +_min_ +: [integer]({{ '/reference/value.html#integer' | relative_url }}) + +_max_ +: [integer]({{ '/reference/value.html#integer' | relative_url }}) + +_return_ +: [integer]({{ '/reference/value.html#integer' | relative_url }}) + +Return a random integer between _min_ and _max_. \ No newline at end of file diff --git a/docs/_posts/2006-01-02-string-functions.md b/docs/_posts/2006-01-02-string-functions.md index b17fd21b..6f8a1699 100644 --- a/docs/_posts/2006-01-02-string-functions.md +++ b/docs/_posts/2006-01-02-string-functions.md @@ -30,31 +30,61 @@ category: reference {: #trim} ``` -TRIM(str string) return string +TRIM(str) ``` -Returns the string str with all leading and trailing white space removed +_str_ +: [string]({{ '/reference/value.html#string' | relative_url }}) + +_return_ +: [string]({{ '/reference/value.html#string' | relative_url }}) + +Returns the string _str_ with all leading and trailing white space removed ``` -TRIM(str string, charset string) return string +TRIM(str, charset) ``` -Returns the string str with all leading and trailing character contained in charset removed +_str_ +: [string]({{ '/reference/value.html#string' | relative_url }}) + +_charset_ +: [string]({{ '/reference/value.html#string' | relative_url }}) + +_return_ +: [string]({{ '/reference/value.html#string' | relative_url }}) + +Returns the string _str_ with all leading and trailing character contained in _charset_ removed ### LTRIM {: #ltrim} ``` -LTRIM(str string) return string +LTRIM(str) ``` -Returns the string str with all leading white space removed +_str_ +: [string]({{ '/reference/value.html#string' | relative_url }}) + +_return_ +: [string]({{ '/reference/value.html#string' | relative_url }}) + +Returns the string _str_ with all leading white space removed ``` -LTRIM(str string, charset string) return string +LTRIM(str, charset) ``` -Returns the string str with all leading character contained in charset removed +_str_ +: [string]({{ '/reference/value.html#string' | relative_url }}) + +_charset_ +: [string]({{ '/reference/value.html#string' | relative_url }}) + +_return_ +: [string]({{ '/reference/value.html#string' | relative_url }}) + +Returns the string _str_ with all leading character contained in _charset_ removed ### RTRIM @@ -63,128 +93,249 @@ Returns the string str with all leading character contained in charset removed {: #trim} ``` -RTRIM(str string) return string +RTRIM(str) ``` -Returns the string str with all trailing white space removed +_str_ +: [string]({{ '/reference/value.html#string' | relative_url }}) + +_return_ +: [string]({{ '/reference/value.html#string' | relative_url }}) + +Returns the string _str_ with all trailing white space removed ``` -RTRIM(str string, charset string) return string +RTRIM(str, charset) ``` -Returns the string str with all trailing character contained in charset removed +_str_ +: [string]({{ '/reference/value.html#string' | relative_url }}) + +_charset_ +: [string]({{ '/reference/value.html#string' | relative_url }}) + +_return_ +: [string]({{ '/reference/value.html#string' | relative_url }}) + +Returns the string _str_ with all trailing character contained in _charset_ removed ### UPPER {: #upper} ``` -UPPER(str string) return string +UPPER(str) ``` -Returns the string str with all characters mapped to their upper case. +_str_ +: [string]({{ '/reference/value.html#string' | relative_url }}) + +_return_ +: [string]({{ '/reference/value.html#string' | relative_url }}) + +Returns the string _str_ with all characters mapped to their upper case. ### LOWER {: #lower} ``` -LOWER(str string) return string +LOWER(str) ``` -Returns the string str with all characters mapped to their lower case. +_str_ +: [string]({{ '/reference/value.html#string' | relative_url }}) + +_return_ +: [string]({{ '/reference/value.html#string' | relative_url }}) + +Returns the string _str_ with all characters mapped to their lower case. ### BASE64_ENCODE {: #base64_encode} ``` -BASE64_ENCODE(str string) return string +BASE64_ENCODE(str) ``` -Return the base64 encoding of string str. +_str_ +: [string]({{ '/reference/value.html#string' | relative_url }}) + +_return_ +: [string]({{ '/reference/value.html#string' | relative_url }}) + +Return the base64 encoding of string _str_. ### BASE64_DECODE {: #base64_decode} ``` -BASE64_DECODE(str string) return string +BASE64_DECODE(str) ``` -Return the string represented by the base64 string str. +_str_ +: [string]({{ '/reference/value.html#string' | relative_url }}) + +_return_ +: [string]({{ '/reference/value.html#string' | relative_url }}) + +Return the string represented by the base64 string _str_. ### HEX_ENCODE {: #hex_encode} ``` -HEX_ENCODE(str string) return string +HEX_ENCODE(str) ``` -Return the hexadecimal encoding of string str. +_str_ +: [string]({{ '/reference/value.html#string' | relative_url }}) + +_return_ +: [string]({{ '/reference/value.html#string' | relative_url }}) + +Return the hexadecimal encoding of string _str_. ### HEX_DECODE {: #hex_decode} ``` -HEX_DECODE(str string) return string +HEX_DECODE(str) ``` -Return the string represented by the hexadecimal string str. +_str_ +: [string]({{ '/reference/value.html#string' | relative_url }}) + +_return_ +: [string]({{ '/reference/value.html#string' | relative_url }}) + +Return the string represented by the hexadecimal string _str_. ### LEN {: #len} ``` -LEN(str string) return integer +LEN(str) ``` -Return the character length of the string str. +_str_ +: [string]({{ '/reference/value.html#string' | relative_url }}) + +_return_ +: [integer]({{ '/reference/value.html#integer' | relative_url }}) + +Return the character length of the string _str_. ### BYTE_LEN {: #byte_len} ``` -BYTE_LEN(str string) return integer +BYTE_LEN(str) ``` -Return the byte length in utf-8 encoding of the string str. +_str_ +: [string]({{ '/reference/value.html#string' | relative_url }}) + +_return_ +: [integer]({{ '/reference/value.html#integer' | relative_url }}) + +Return the byte length in utf-8 encoding of the string _str_. ### LPAD {: #lpad} ``` -LPAD(str string, len integer, padstr string) return string +LPAD(str, len, padstr) ``` -Return the string str padded with leading string padstr to a length specified by len. +_str_ +: [string]({{ '/reference/value.html#string' | relative_url }}) + +_len_ +: [integer]({{ '/reference/value.html#integer' | relative_url }}) + +_padstr_ +: [string]({{ '/reference/value.html#string' | relative_url }}) + +_return_ +: [string]({{ '/reference/value.html#string' | relative_url }}) + +Return the string _str_ padded with leading _padstr_ to a length specified by _len_. ### RPAD {: #rpad} ``` -RPAD(str string, len integer, padstr string) return string +RPAD(str, len, padstr) ``` -Return the string str padded with trailing string padstr to a length specified by len. +_str_ +: [string]({{ '/reference/value.html#string' | relative_url }}) + +_len_ +: [integer]({{ '/reference/value.html#integer' | relative_url }}) + +_padstr_ +: [string]({{ '/reference/value.html#string' | relative_url }}) + +_return_ +: [string]({{ '/reference/value.html#string' | relative_url }}) + +Return the string _str_ padded with trailing _padstr_ to a length specified by _len_. ### SUBSTR {: #substr} ``` -SUBSTR(str string, pos integer) return string +SUBSTR(str, position) ``` -Return a substring of the string str from at position pos to the end. -If pos is negative, starting position is pos from the end of the str. +_str_ +: [string]({{ '/reference/value.html#string' | relative_url }}) + +_position_ +: [integer]({{ '/reference/value.html#integer' | relative_url }}) + +_return_ +: [string]({{ '/reference/value.html#string' | relative_url }}) + +Return a substring of the string _str_ from at _position_ to the end. +If _position_ is negative, starting position is _position_ from the end of the str. ``` -SUBSTR(str string, pos integer, len integer) return string +SUBSTR(str, position, len) ``` -Return a len characters substring of the string str from at position pos. -if len is less than the length from pos to the end, return a substring from pos to the end. +_str_ +: [string]({{ '/reference/value.html#string' | relative_url }}) + +_position_ +: [integer]({{ '/reference/value.html#integer' | relative_url }}) + +_len_ +: [integer]({{ '/reference/value.html#integer' | relative_url }}) + +_return_ +: [string]({{ '/reference/value.html#string' | relative_url }}) + +Return a _len_ characters substring of the string _str_ from at _position_. +if _len_ is less than the length from _position_ to the end, return a substring from _position_ to the end. ### REPLACE {: #replace} ``` -REPLACE(str string, old string, new string) return string +REPLACE(str, old, new) ``` -Return the string str with all occurrences of the string old replaced by the string new. + +_str_ +: [string]({{ '/reference/value.html#string' | relative_url }}) + +_old_ +: [string]({{ '/reference/value.html#string' | relative_url }}) + +_new_ +: [string]({{ '/reference/value.html#string' | relative_url }}) + +_return_ +: [string]({{ '/reference/value.html#string' | relative_url }}) + +Return the string _str_ with all occurrences of the string _old_ replaced by the string _new_. diff --git a/docs/_posts/2006-01-02-system-functions.md b/docs/_posts/2006-01-02-system-functions.md index 6788c18d..7fba0bb1 100644 --- a/docs/_posts/2006-01-02-system-functions.md +++ b/docs/_posts/2006-01-02-system-functions.md @@ -8,8 +8,8 @@ category: reference | name | description | | :- | :- | -| [AUTO_INCREMENT](#auto_increment) | | -| [CALL](#call) | | +| [AUTO_INCREMENT](#auto_increment) | Return a sequence number in a single query | +| [CALL](#call) | Execute a external command | ## Definitions @@ -17,17 +17,38 @@ category: reference {: #auto_increment} ``` -AUTO_INCREMENT() return integer +AUTO_INCREMENT() ``` +Return a sequence number that starts with 1 in a single query. + ``` -AUTO_INCREMENT(init integer) return integer +AUTO_INCREMENT(initial_value) ``` +_initial_value_ +: [integer]({{ '/reference/value.html#integer' | relative_url }}) + +_return_ +: [integer]({{ '/reference/value.html#integer' | relative_url }}) + +Return a sequence number that starts with _initial_value_ in a single query. + ### CALL {: #call} ``` -CALL(command string [, value ...]) return string +CALL(command [, argument ...]) ``` +_command_ +: [string]({{ '/reference/value.html#string' | relative_url }}) + +_argument_ +: [string]({{ '/reference/value.html#string' | relative_url }}) + +_return_ +: [string]({{ '/reference/value.html#string' | relative_url }}) + +Execute a external command then return the standard output as a string. +If the external command failed, the executing procedure is terminated with an error. \ No newline at end of file