diff --git a/doc/book/box/box_space.rst b/doc/book/box/box_space.rst index b88fc76a74..907f9d6514 100644 --- a/doc/book/box/box_space.rst +++ b/doc/book/box/box_space.rst @@ -291,50 +291,50 @@ Below is a list of all ``box.space`` functions and members. .. tabularcolumns:: |\Y{0.2}|\Y{0.3}|\Y{0.2}|\Y{0.3}| - +---------------------+-------------------------------------------------------+----------------------------------+-------------------------------+ - | Name | Effect | Type | Default | - +=====================+=======================================================+==================================+===============================+ - | type | type of index | string | 'TREE' | - | | | ('HASH' or 'TREE' or | | - | | | 'BITSET' or 'RTREE') | | - | | | Note re storage engine: | | - | | | vinyl only supports 'TREE' | | - +---------------------+-------------------------------------------------------+----------------------------------+-------------------------------+ - | id | unique identifier | number | last index's id, +1 | - +---------------------+-------------------------------------------------------+----------------------------------+-------------------------------+ - | unique | index is unique | boolean | ``true`` | - +---------------------+-------------------------------------------------------+----------------------------------+-------------------------------+ - | if_not_exists | no error if duplicate name | boolean | ``false`` | - +---------------------+-------------------------------------------------------+----------------------------------+-------------------------------+ - | parts | field-numbers + types | {field_no, ``'unsigned'`` or | ``{1, 'unsigned'}`` | - | | | ``'string'`` or ``'integer'`` or | | - | | | ``'number'`` or ``'boolean'`` or | | - | | | ``'varbinary'`` or | | - | | | ``'array'`` or ``'scalar'``, | | - | | | and optional collation or | | - | | | is_nullable value or path} | | - +---------------------+-------------------------------------------------------+----------------------------------+-------------------------------+ - | dimension | affects :ref:`RTREE ` only | number | 2 | - +---------------------+-------------------------------------------------------+----------------------------------+-------------------------------+ - | distance | affects RTREE only | string ('euclid' or | 'euclid' | - | | | 'manhattan') | | - +---------------------+-------------------------------------------------------+----------------------------------+-------------------------------+ - | bloom_fpr | affects vinyl only | number | ``vinyl_bloom_fpr`` | - +---------------------+-------------------------------------------------------+----------------------------------+-------------------------------+ - | page_size | affects vinyl only | number | ``vinyl_page_size`` | - +---------------------+-------------------------------------------------------+----------------------------------+-------------------------------+ - | range_size | affects vinyl only | number | ``vinyl_range_size`` | - +---------------------+-------------------------------------------------------+----------------------------------+-------------------------------+ - | run_count_per_level | affects vinyl only | number | ``vinyl_run_count_per_level`` | - +---------------------+-------------------------------------------------------+----------------------------------+-------------------------------+ - | run_size_ratio | affects vinyl only | number | ``vinyl_run_size_ratio`` | - +---------------------+-------------------------------------------------------+----------------------------------+-------------------------------+ - | sequence | see section regarding | string or number | not present | - | | :ref:`specifying a sequence in create_index() | | | - | | ` | | | - +---------------------+-------------------------------------------------------+----------------------------------+-------------------------------+ - | func | :ref:`functional index ` | string | not present | - +---------------------+-------------------------------------------------------+----------------------------------+-------------------------------+ + +---------------------+-------------------------------------------------------+----------------------------------+------------------------------------+ + | Name | Effect | Type | Default | + +=====================+=======================================================+==================================+====================================+ + | type | type of index | string | 'TREE' | + | | | ('HASH' or 'TREE' or | | + | | | 'BITSET' or 'RTREE') | | + | | | Note re storage engine: | | + | | | vinyl only supports 'TREE' | | + +---------------------+-------------------------------------------------------+----------------------------------+------------------------------------+ + | id | unique identifier | number | last index's id, +1 | + +---------------------+-------------------------------------------------------+----------------------------------+------------------------------------+ + | unique | index is unique | boolean | ``true`` | + +---------------------+-------------------------------------------------------+----------------------------------+------------------------------------+ + | if_not_exists | no error if duplicate name | boolean | ``false`` | + +---------------------+-------------------------------------------------------+----------------------------------+------------------------------------+ + | parts | field-numbers + types | {field_no, ``'unsigned'`` or | ``{field = 1, type = 'unsigned'}`` | + | | | ``'string'`` or ``'integer'`` or | | + | | | ``'number'`` or ``'boolean'`` or | | + | | | ``'varbinary'`` or | | + | | | ``'array'`` or ``'scalar'``, | | + | | | and optional collation or | | + | | | is_nullable value or path} | | + +---------------------+-------------------------------------------------------+----------------------------------+------------------------------------+ + | dimension | affects :ref:`RTREE ` only | number | 2 | + +---------------------+-------------------------------------------------------+----------------------------------+------------------------------------+ + | distance | affects RTREE only | string ('euclid' or | 'euclid' | + | | | 'manhattan') | | + +---------------------+-------------------------------------------------------+----------------------------------+------------------------------------+ + | bloom_fpr | affects vinyl only | number | ``vinyl_bloom_fpr`` | + +---------------------+-------------------------------------------------------+----------------------------------+------------------------------------+ + | page_size | affects vinyl only | number | ``vinyl_page_size`` | + +---------------------+-------------------------------------------------------+----------------------------------+------------------------------------+ + | range_size | affects vinyl only | number | ``vinyl_range_size`` | + +---------------------+-------------------------------------------------------+----------------------------------+------------------------------------+ + | run_count_per_level | affects vinyl only | number | ``vinyl_run_count_per_level`` | + +---------------------+-------------------------------------------------------+----------------------------------+------------------------------------+ + | run_size_ratio | affects vinyl only | number | ``vinyl_run_size_ratio`` | + +---------------------+-------------------------------------------------------+----------------------------------+------------------------------------+ + | sequence | see section regarding | string or number | not present | + | | :ref:`specifying a sequence in create_index() | | | + | | ` | | | + +---------------------+-------------------------------------------------------+----------------------------------+------------------------------------+ + | func | :ref:`functional index ` | string | not present | + +---------------------+-------------------------------------------------------+----------------------------------+------------------------------------+ The options in the above chart are also applicable for :ref:`index_object:alter() `. @@ -367,7 +367,7 @@ Below is a list of all ``box.space`` functions and members. tarantool> s = box.space.tester --- ... - tarantool> s:create_index('primary', {unique = true, parts = {1, 'unsigned', 2, 'string'}}) + tarantool> s:create_index('primary', {unique = true, parts = {field = 1, type = 'unsigned', field = 2, type = 'string'}}) --- ... @@ -483,7 +483,7 @@ Below is a list of all ``box.space`` functions and members. .. code-block:: lua - box.space.tester:create_index('I',{unique=true,parts={{2,'number',is_nullable=true}}}) + box.space.tester:create_index('I',{unique=true,parts={{field = 2, type = 'number', is_nullable = true}}}) .. WARNING:: @@ -507,7 +507,7 @@ Below is a list of all ``box.space`` functions and members. .. code-block:: lua box.space.tester:format({{name='x', type='scalar'}, {name='y', type='integer'}}) - box.space.tester:create_index('I2',{parts={{'x','scalar'}}}) + box.space.tester:create_index('I2',{parts={{'x', 'scalar'}}}) box.space.tester:create_index('I3',{parts={{'x','scalar'},{'y','integer'}}}) box.space.tester:create_index('I4',{parts={1,'scalar'}}) box.space.tester:create_index('I5',{parts={1,'scalar',2,'integer'}}) @@ -531,7 +531,7 @@ Below is a list of all ``box.space`` functions and members. -- Example 1 -- The simplest use of path: -- Result will be - - [{'age': 44}] box.schema.space.create('T') - box.space.T:create_index('I',{parts={{1, 'scalar', path='age'}}}) + box.space.T:create_index('I',{parts={{field = 1, type = 'scalar', path = 'age'}}}) box.space.T:insert{{age=44}} box.space.T:select(44) -- Example 2 -- path plus format() plus JSON syntax to add clarity @@ -553,7 +553,7 @@ Below is a list of all ``box.space`` functions and members. Indexes defined with this are useful for JSON documents that all have the same structure. For example, when creating an index on field#2 for a string document that will start with ``{'data': [{'name': '...'}, {'name': '...'}]``, the parts section in the - create_index request could look like: ``parts = {{2, 'str', path = 'data[*].name'}}``. + create_index request could look like: ``parts = {{field = 2, type = 'str', path = 'data[*].name'}}``. Then tuples containing names can be retrieved quickly with ``index_object:select({key-value})``. In fact a single field can have multiple keys, as in this example which retrieves the same tuple twice because there are two keys 'A' and 'B' which both match the request: @@ -562,7 +562,7 @@ Below is a list of all ``box.space`` functions and members. s = box.schema.space.create('json_documents') s:create_index('primarykey') - i = s:create_index('multikey', {parts = {{2, 'str', path = 'data[*].name'}}}) + i = s:create_index('multikey', {parts = {{field = 2, type = 'str', path = 'data[*].name'}}}) s:insert({1, {data = {{name='A'}, {name='B'}}, @@ -620,7 +620,7 @@ Below is a list of all ``box.space`` functions and members. -- The space needs a primary-key field, which is not the field that we -- will use for the functional index. box.schema.space.create('x', {engine = 'memtx'}) - box.space.x:create_index('i',{parts={1, 'string'}}) + box.space.x:create_index('i',{parts={field = 1, type = 'string'}}) -- Step 2: Make the function. -- The function expects a tuple. In this example it will work on tuple[2] -- because the key souce is field number 2 in what we will insert. @@ -633,7 +633,7 @@ Below is a list of all ``box.space`` functions and members. -- Step 4: Make the functional index. -- Specify the fields whose values will be passed to the function. -- Specify the function. - box.space.x:create_index('j',{parts={1, 'string'},func = 'F'}) + box.space.x:create_index('j',{parts={field = 1, type = 'string'},func = 'F'}) -- Step 5: Test. -- Insert a few tuples. -- Select using only the first letter, it will work because that is the key @@ -674,7 +674,7 @@ Below is a list of all ``box.space`` functions and members. s = box.schema.space.create('withdata') s:format({{name = 'name', type = 'string'}, {name = 'address', type = 'string'}}) - pk = s:create_index('name', {parts = {1, 'string'}}) + pk = s:create_index('name', {parts = {field = 1, type = 'string'}}) lua_code = [[function(tuple) local address = string.split(tuple[2]) local ret = {} @@ -690,7 +690,7 @@ Below is a list of all ``box.space`` functions and members. opts = {is_multikey = true}}) idx = s:create_index('addr', {unique = false, func = 'address', - parts = {{1, 'string', + parts = {{field = 1, type = 'string', collation = 'unicode_ci'}}}) s:insert({"James", "SIS Building Lambeth London UK"}) s:insert({"Sherlock", "221B Baker St Marylebone London NW1 6XE UK"}) @@ -875,7 +875,7 @@ Below is a list of all ``box.space`` functions and members. > {name='8',type='array'}, > {name='9',type='map'}}) --- ... - tarantool> box.space.t:create_index('i',{parts={2,'unsigned'}}) + tarantool> box.space.t:create_index('i',{parts={field = 2, type = 'unsigned'}}) --- ... tarantool> box.space.t:insert{{'a'}, -- any > 1, -- unsigned @@ -1137,7 +1137,7 @@ Below is a list of all ``box.space`` functions and members. .. code-block:: tarantoolsession tarantool> s = box.schema.space.create('space53') - tarantool> s:create_index('primary', {parts = {1, 'unsigned'}}) + tarantool> s:create_index('primary', {parts = {field = 1, type = 'unsigned'}}) tarantool> function replace_trigger() > replace_counter = replace_counter + 1 > end @@ -1431,7 +1431,7 @@ Below is a list of all ``box.space`` functions and members. tarantool> s = box.schema.space.create('tmp', {temporary=true}) --- ... - tarantool> s:create_index('primary',{parts = {1,'unsigned', 2, 'string'}}) + tarantool> s:create_index('primary',{parts = {field = 1, type = 'unsigned', field = 2, type = 'string'}}) --- ... tarantool> s:insert{1,'A'} @@ -2690,11 +2690,11 @@ for each :ref:`data operation ` in Tarantool: format[3] = {'field3', 'unsigned'} s = box.schema.create_space('test', {format = format}) -- Create a primary index -- - pk = s:create_index('pk', {parts = {{'field1'}}}) + pk = s:create_index('pk', {parts = {{field = 'field1'}}}) -- Create a unique secondary index -- - sk_uniq = s:create_index('sk_uniq', {parts = {{'field2'}}}) + sk_uniq = s:create_index('sk_uniq', {parts = {{field = 'field2'}}}) -- Create a non-unique secondary index -- - sk_non_uniq = s:create_index('sk_non_uniq', {parts = {{'field3'}}, unique = false}) + sk_non_uniq = s:create_index('sk_non_uniq', {parts = {{field = 'field3'}}, unique = false}) .. _box_space-operations-insert: @@ -2820,7 +2820,7 @@ The key must be full: ``delete`` cannot work with partial keys. tarantool> s2 = box.schema.create_space('test2') --- ... - tarantool> pk2 = s2:create_index('pk2', {parts = {{1, 'unsigned'}, {2, 'unsigned'}}}) + tarantool> pk2 = s2:create_index('pk2', {parts = {{field = 1, type = 'unsigned'}, {field = 2, type = 'unsigned'}}}) --- ... tarantool> s2:insert{1, 1} diff --git a/doc/book/box/data_model.rst b/doc/book/box/data_model.rst index 8e8252192f..c3472d8a94 100644 --- a/doc/book/box/data_model.rst +++ b/doc/book/box/data_model.rst @@ -95,7 +95,7 @@ field #1 of each tuple: .. code-block:: tarantoolsession - tarantool> i = s:create_index('primary', {type = 'hash', parts = {1, 'unsigned'}}) + tarantool> i = s:create_index('primary', {type = 'hash', parts = {field = 1, type = 'unsigned'}}) The effect is that, for all tuples in space 'tester', field #1 must exist and must contain an unsigned integer. @@ -107,7 +107,7 @@ of each tuple: .. code-block:: tarantoolsession - tarantool> i = s:create_index('secondary', {type = 'tree', parts = {2, 'string'}}) + tarantool> i = s:create_index('secondary', {type = 'tree', parts = {field = 2, type = 'string'}}) The effect is that, for all tuples in space 'tester', field #2 must exist and must contain a string. @@ -389,7 +389,7 @@ As an example, take some Russian words: .. code-block:: tarantoolsession - tarantool> box.space.T:create_index('I', {parts = {{1,'str', collation='unicode'}}}) + tarantool> box.space.T:create_index('I', {parts = {{field = 1, type = 'str', collation='unicode'}}}) ... tarantool> box.space.T.index.I:select() --- @@ -412,7 +412,7 @@ As an example, take some Russian words: .. code-block:: tarantoolsession - tarantool> box.space.T:create_index('I', {parts = {{1,'str', collation='unicode_ci'}}}) + tarantool> box.space.T:create_index('I', {parts = {{field = 1, type ='str', collation='unicode_ci'}}}) ... tarantool> box.space.S.index.I:select() --- @@ -841,7 +841,7 @@ The following SELECT variations exist: tarantool> box.schema.space.create('bitset_example') tarantool> box.space.bitset_example:create_index('primary') - tarantool> box.space.bitset_example:create_index('bitset',{unique=false,type='BITSET', parts={2,'unsigned'}}) + tarantool> box.space.bitset_example:create_index('bitset',{unique=false,type='BITSET', parts={field = 2, type = 'unsigned'}}) tarantool> box.space.bitset_example:insert{1,1} tarantool> box.space.bitset_example:insert{2,4} tarantool> box.space.bitset_example:insert{3,7} @@ -865,7 +865,7 @@ The following SELECT variations exist: tarantool> box.schema.space.create('rtree_example') tarantool> box.space.rtree_example:create_index('primary') - tarantool> box.space.rtree_example:create_index('rtree',{unique=false,type='RTREE', parts={2,'ARRAY'}}) + tarantool> box.space.rtree_example:create_index('rtree',{unique=false,type='RTREE', parts={field = 2, type = 'ARRAY'}}) tarantool> box.space.rtree_example:insert{1, {3, 5, 9, 10}} tarantool> box.space.rtree_example:insert{2, {10, 11}} tarantool> box.space.rtree_example.index.rtree:select({4, 7, 5, 9}, {iterator = 'GT'}) diff --git a/doc/book/sql.rst b/doc/book/sql.rst index e9844df76e..49a99196d9 100644 --- a/doc/book/sql.rst +++ b/doc/book/sql.rst @@ -61,8 +61,8 @@ marked "Okay" will probably be balanced by tests which are unfairly marked "Fail | E021-03 | Character literals | ``insert into t45 values ('');`` | Okay, and the bad practice of accepting ""'s for | | | | | character literals is avoided. | +------------+-----------------------------------------------+----------------------------------------------------------+---------------------------------------------------------+ - | E021-04 | CHARACTER_LENGTH function | ``select character_length(s1) from t;`` | Fail. There is no such function. There is a function | - | | | | LENGTH(), which is okay. | + | E021-04 | :ref:`CHARACTER_LENGTH ` | ``select character_length(s1) from t;`` | Fail. There is no such function. There is a function | + | | function | | LENGTH(), which is okay. | +------------+-----------------------------------------------+----------------------------------------------------------+---------------------------------------------------------+ | E021-05 | OCTET_LENGTH | ``select octet_length(s1) from t;`` | Fail. There is no such function. | +------------+-----------------------------------------------+----------------------------------------------------------+---------------------------------------------------------+ @@ -71,7 +71,8 @@ marked "Okay" will probably be balanced by tests which are unfairly marked "Fail +------------+-----------------------------------------------+----------------------------------------------------------+---------------------------------------------------------+ | E021-07 | Character concatenation | ``select 'a' || 'b' from t;`` | Okay. | +------------+-----------------------------------------------+----------------------------------------------------------+---------------------------------------------------------+ - | E021-08 | UPPER and LOWER functions | ``select upper('a'),lower('B') from t;`` | Okay. | + | E021-08 | :ref:`UPPER ` and | ``select upper('a'),lower('B') from t;`` | Okay. | + | | :ref:`LOWER ` functions | | SUBSTR(x,n,n) which is okay. | +------------+-----------------------------------------------+----------------------------------------------------------+---------------------------------------------------------+ | E021-09 | TRIM function | ``select trim('a ') from t;`` | Okay. | +------------+-----------------------------------------------+----------------------------------------------------------+---------------------------------------------------------+ @@ -99,14 +100,14 @@ marked "Okay" will probably be balanced by tests which are unfairly marked "Fail +------------+-----------------------------------------------+----------------------------------------------------------+---------------------------------------------------------+ | E051-01 | SELECT DISTINCT | ``select distinct s1 from t;`` | Okay. | +------------+-----------------------------------------------+----------------------------------------------------------+---------------------------------------------------------+ - | E051-02 | GROUP BY clause | ``select distinct s1 from t group by s1;`` | Okay. | + | E051-02 | :ref:`GROUP BY ` clause | ``select distinct s1 from t group by s1;`` | Okay. | +------------+-----------------------------------------------+----------------------------------------------------------+---------------------------------------------------------+ | E051-04 | GROUP BY can contain columns not in select | ``select s1 from t group by lower(s1);`` | Okay. | | | list | | | +------------+-----------------------------------------------+----------------------------------------------------------+---------------------------------------------------------+ | E051-05 | Select list items can be renamed | ``select s1 as K from t order by K;`` | Okay. | +------------+-----------------------------------------------+----------------------------------------------------------+---------------------------------------------------------+ - | E051-06 | HAVING clause | ``select count(*) from t having count(*) > 0;`` | Okay. GROUP BY is not mandatory before HAVING. | + | E051-06 | :ref:`HAVING ` clause | ``select count(*) from t having count(*) > 0;`` | Okay. GROUP BY is not mandatory before HAVING. | +------------+-----------------------------------------------+----------------------------------------------------------+---------------------------------------------------------+ | E051-07 | Qualified * in select list | ``select t.* from t;`` | Okay. | +------------+-----------------------------------------------+----------------------------------------------------------+---------------------------------------------------------+ @@ -185,15 +186,15 @@ marked "Okay" will probably be balanced by tests which are unfairly marked "Fail +------------+-----------------------------------------------+----------------------------------------------------------+---------------------------------------------------------+ | E091 | Set functions | +------------+-----------------------------------------------+----------------------------------------------------------+---------------------------------------------------------+ - | E091-01 | AVG | ``select avg(s1) from t7;`` | Fail. No warning that nulls were eliminated. | + | E091-01 | :ref:`AVG ` | ``select avg(s1) from t7;`` | Fail. No warning that nulls were eliminated. | +------------+-----------------------------------------------+----------------------------------------------------------+---------------------------------------------------------+ - | E091-02 | COUNT | ``select count(*) from t7 where s1 > 0;`` | Okay. | + | E091-02 | :ref:`COUNT ` | ``select count(*) from t7 where s1 > 0;`` | Okay. | +------------+-----------------------------------------------+----------------------------------------------------------+---------------------------------------------------------+ - | E091-03 | MAX | ``select max(s1) from t7 where s1 > 0;`` | Okay. | + | E091-03 | :ref:`MAX ` | ``select max(s1) from t7 where s1 > 0;`` | Okay. | +------------+-----------------------------------------------+----------------------------------------------------------+---------------------------------------------------------+ - | E091-04 | MIN | ``select min(s1) from t7 where s1 > 0;`` | Okay. | + | E091-04 | :ref:`MIN ` | ``select min(s1) from t7 where s1 > 0;`` | Okay. | +------------+-----------------------------------------------+----------------------------------------------------------+---------------------------------------------------------+ - | E091-05 | SUM | ``select sum(1) from t7 where s1 > 0;`` | Okay. | + | E091-05 | :ref:`SUM ` | ``select sum(1) from t7 where s1 > 0;`` | Okay. | +------------+-----------------------------------------------+----------------------------------------------------------+---------------------------------------------------------+ | E091-06 | ALL quantifier | ``select sum(all s1) from t7 where s1 > 0;`` | Okay. | +------------+-----------------------------------------------+----------------------------------------------------------+---------------------------------------------------------+ diff --git a/doc/reference/reference_lua/string.rst b/doc/reference/reference_lua/string.rst index 400de0664d..ca82662a3c 100644 --- a/doc/reference/reference_lua/string.rst +++ b/doc/reference/reference_lua/string.rst @@ -284,7 +284,9 @@ Below is a list of all additional ``string`` functions. :param input-string: (string) the string to split :param split-string: (string) the string to find within ``input-string``. Default = space. - :param max: (integer) maximum number of delimiters to process counting from the beginning of the input string. Result will contain max + 1 parts maximum. + :param max: (integer) maximum number of delimiters to process counting + from the beginning of the input string. Result will + contain max + 1 parts maximum. :Return: table of strings that were split from ``input-string`` :Rtype: table diff --git a/doc/reference/reference_lua/utf8.rst b/doc/reference/reference_lua/utf8.rst index 5cad211741..d260e59341 100644 --- a/doc/reference/reference_lua/utf8.rst +++ b/doc/reference/reference_lua/utf8.rst @@ -18,8 +18,6 @@ there are comparison functions which understand the default ordering for Cyrillic (Capital Letter Zhe Ж = Small Letter Zhe ж) and Japanese (Hiragana A = Katakana A). -The module is fully built-in so ``require('utf8')`` is not necessary. - .. container:: table .. rst-class:: left-align-column-1 diff --git a/doc/reference/reference_sql/sql.rst b/doc/reference/reference_sql/sql.rst index 029ec74c9f..efeac45d71 100644 --- a/doc/reference/reference_sql/sql.rst +++ b/doc/reference/reference_sql/sql.rst @@ -127,9 +127,9 @@ definition. Rules: * A primary key is necessary; it can be specified with a table constraint - PRIMARY KEY. + ``PRIMARY KEY``. * There must be at least one column. -* When IF NOT EXISTS is specified, and there is already a table with the same +* When ``IF NOT EXISTS`` is specified, and there is already a table with the same name, the statement is ignored. Actions: @@ -137,7 +137,7 @@ Actions: #. Tarantool evaluates each column definition and *table-constraint*, and returns an error if any of the rules is violated. #. Tarantool makes a new definition in the schema. -#. Tarantool makes new indexes for PRIMARY KEY or UNIQUE constraints. +#. Tarantool makes new indexes for ``PRIMARY KEY`` or ``UNIQUE`` constraints. A unique index name is created automatically. #. Tarantool effectively executes a ``COMMIT`` statement. @@ -1717,21 +1717,29 @@ GROUP BY clause is omitted, then Tarantool assumes NULLs are ignored for all aggregate functions except COUNT(*). +.. _sql_aggregate_avg: + ``AVG([DISTINCT] expression)`` Return the average value of expression. Example: :samp:`AVG({column1})` +.. _sql_aggregate_count_exp: + ``COUNT([DISTINCT] expression)`` Return the number of occurrences of expression. Example: :samp:`COUNT({column1})` +.. _sql_aggregate_count_row: + ``COUNT(*)`` Return the number of occurrences of a row. Example: :samp:`COUNT(*)` +.. _sql_aggregate_group_concat: + ``GROUP_CONCAT(expression-1 [, expression-2])`` Return a list of *expression-1* values, separated by commas if *expression-2* is omitted, or separated @@ -1740,21 +1748,29 @@ NULLs are ignored for all aggregate functions except COUNT(*). Example: :samp:`GROUP_CONCAT({column1})` +.. _sql_aggregate_max: + ``MAX([DISTINCT] expression)`` Return the maximum value of expression. Example: :samp:`MAX({column1})` +.. _sql_aggregate_min: + ``MIN([DISTINCT] expression)`` Return the minimum value of expression. Example: :samp:`MIN({column1})` +.. _sql_aggregate_sum: + ``SUM([DISTINCT] expression)`` Return the sum of values of expression. Example: :samp:`SUM({column1})` +.. _sql_aggregate_total: + ``TOTAL([DISTINCT] expression)`` Return the sum of values of expression. @@ -2665,7 +2681,7 @@ Syntax: Return the value of the first non-NULL expression, or, if both expression values are NULL, return NULL. Thus ``IFNULL(expression, expression)`` is the same as -``COALESCE(expression, expression)``. +:ref:`COALESCE(expression, expression) `. Example: ``IFNULL(NULL, 17)`` is 17 @@ -2696,6 +2712,21 @@ Examples: * ``LENGTH(CHAR(0,65))`` is 2, '\0' does not mean 'end of string'. * ``LENGTH(X'410041')`` is 3, X'...' byte sequences have type VARBINARY. +.. _sql_function_lower: + +*********************************************** +LOWER +*********************************************** + +Syntax: + +:samp:`LOWER(string-expression)` + +Return the expression, with upper-case characters converted to lower case. +This is the reverse of :ref:`UPPER(string-expression) `. + +Example: ``LOWER('-4ЩL')`` is '-4щl'. + .. _sql_function_nullif: *********************************************** @@ -2787,7 +2818,7 @@ Syntax: Return the Unicode code point value of the first character of **string-expression**. If *string-expression* is empty, the return is NULL. -This is the reverse of CHAR(integer). +This is the reverse of :ref:`CHAR(integer) `. Example: ``UNICODE('Щ')`` is 1065 (hexadecimal 0429). @@ -2802,7 +2833,7 @@ Syntax: :samp:`UPPER(string-expression)` Return the expression, with lower-case characters converted to upper case. -This is the reverse of LOWER(string-expression). +This is the reverse of :ref:`LOWER(string-expression)`. Example: ``UPPER('-4щl')`` is '-4ЩL'.