# Что такое collation?

**Collation** — это набор правил, определяющих:

1. **Как сравниваются строки** (например, `a` = `A` или нет).
2. **Как сортируются строки** (например, `ä` идёт после `a` или вместе с `a`).
3. **Какая кодировка используется** (например, `utf8_general_ci`, `utf8mb4_unicode_ci`).

***

🔑 **Простыми словами:**\
Collation отвечает за то, как база данных понимает и сравнивает текст: учитывает ли она регистр букв, язык, алфавит и порядок символов.

***

#### Примеры:

* `utf8_general_ci`
  * `ci` = case insensitive (регистр не важен).
  * `'Hello'` = `'hello'`.
* `utf8_bin`
  * Сравнение идёт по байтам.
  * `'Hello'` ≠ `'hello'`.
* `utf8mb4_unicode_ci`
  * Более "умный" вариант, учитывающий языковые особенности (например, в немецком `ß` = `ss`).

***

📌 **Итого:**\
Collation — это "языковые правила" для строк в БД: сравнение, сортировка, учёт регистра и акцентов.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://kaze.gitbook.io/qa-theory/bazy-dannykh/chto-takoe-collation.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
