lab/note/资源/数据库/SQL/函数.md
张育新 be711334fb docs(note): 添加笔记目录及 gitignore 规则
- 新增 note 目录包含 AI、SQL、Golang、网络等多领域学习笔记
- 更新 .gitignore 添加 note/assets/ 和 note/项目/ 忽略规则
2026-07-10 09:24:40 +08:00

22 lines
792 B
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

## CONCAT函数
`CONCAT` 是 SQL 中用于**字符串拼接**的函数,它可以将两个或多个字符串合并成一个新的字符串。
------
### 基本语法
```sql
CONCAT(string1, string2, ..., stringN)
```
### 不同数据库的 CONCAT 行为
| 数据库 | 行为 |
| :--------------------- | :----------------------------------------------- |
| **MySQL** | 支持多参数;**任一参数为 NULL整个结果为 NULL** |
| **SQL Server** (2012+) | 支持多参数;**NULL 会被自动转为空字符串** `''` |
| **Oracle** | 只支持 **2 个参数**NULL 视为空字符串 |
| **PostgreSQL** | 支持多参数NULL 视为空字符串 |