Skip to content
Snippets Groups Projects
Commit 0b98c0ec authored by Artur Sabirov's avatar Artur Sabirov Committed by Yaroslav Dynnikov
Browse files

sql/substr.md: new page

parent eef70f6e
No related branches found
No related tags found
1 merge request!534sql/substr.md: new page
Pipeline #50097 passed
File suppressed by a .gitattributes entry or the file's encoding is unsupported.
File suppressed by a .gitattributes entry or the file's encoding is unsupported.
......@@ -183,10 +183,10 @@ td.td3 ul {
<td></td>
</tr>
<tr>
<td class="center"><span class="absent">E021-06</span></td>
<td class="center"><span class="partly">E021-06</span></td>
<td>Функция SUBSTRING</td>
<td class="td3 center"></td>
<td></td>
<td class="td3 center">[SUBSTR](sql/substr.md)</td>
<td>Функция SUBSTRING не поддерживается, но есть SUBSTR</td>
</tr>
<tr>
<td class="center"><span class="full">E021-07</span></td>
......
# SUBSTR {: #substr }
Функция `SUBSTR` извлекает подстроку из строки *string*, начиная с позиции
*from*, длиной *count* символов.
Нумерация символов в строке *string* начинается с единицы. Если длина
*count* не указана, конец подстроки будет совпадать с концом строки
*string*.
!!! note "Примечание"
*from* и *count* — результаты [выражений](#expression) типа [UNSIGNED].
[UNSIGNED]: ../sql_types.md#unsigned
## Синтаксис {: #syntax }
![SUBSTR](../../images/ebnf/substr.svg)
### Выражение {: #expression }
??? note "Диаграмма"
![Expression](../../images/ebnf/expression.svg)
### Литерал {: #literal }
??? note "Диаграмма"
![Literal](../../images/ebnf/literal.svg)
## Примеры {: #examples }
```title="Запрос VALUES с функцией SUBSTR и параметром <i>from</i>"
picodata> VALUES ( SUBSTR('picodata', 3) );
+----------+
| COLUMN_1 |
+==========+
| "codata" |
+----------+
(1 rows)
```
```title="Запрос VALUES с функцией SUBSTR и параметрами <i>from</i> и <i>count</i>"
picodata> VALUES ( SUBSTR('picodata', 3, 4) );
+----------+
| COLUMN_1 |
+==========+
| "coda" |
+----------+
(1 rows)
```
......@@ -45,6 +45,7 @@
* [Агрегатные функции](reference/sql/aggregate.md)
* [CASE](reference/sql/case.md)
* [CAST](reference/sql/cast.md)
* [SUBSTR](reference/sql/substr.md)
* [TRIM](reference/sql/trim.md)
### Дата и время {: #date_and_time }
......
......@@ -91,6 +91,7 @@ nav:
- reference/sql/aggregate.md
- reference/sql/case.md
- reference/sql/cast.md
- reference/sql/substr.md
- reference/sql/trim.md
- Дата и время:
- reference/sql/current_date.md
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment