sql中concat函数_SQL中的CONCAT函数概述和示例

sql中concat函数

In this article, we will explore the syntax, working mechanism and other details of the CONCAT function in SQL and we will also make up various different examples about it.

在本文中,我们将探讨SQL中CONCAT函数的语法,工作机制和其他细节,并且还将组成各种有关它的示例。

介绍 (Introduction )

A string is a set of characters that helps to declare the texts in the programming languages. In terms of SQL Server, we can categorize SQL string data types into different two groups. These are:

字符串是一组字符,有助于以编程语言声明文本。 在SQL Server方面,我们可以将SQL字符串数据类型分为不同的两组。 这些是:

  • Character strings data types that store non-Unicode character data

    存储非Unicode字符数据的字符串数据类型

    Character strings data types

    Data type

    Min limit

    Max limit

    char

    0 chars

    8000 chars

    varchar

    0 chars

    8000 chars

    varchar (max)

    0 chars

    2^31 chars

    text

    0 chars

    2,147,483,647 chars

    字符串数据类型

    数据类型

    最低限度

    最高限额

    烧焦

    0个字符

    8000个字符

    varchar

    0个字符

    8000个字符

    varchar(最大值)

    0个字符

    2 ^ 31个字符

    文本

    0个字符

    2,147,483,647字符

  • Unicode character strings data types that store Unicode character data

    存储Unicode字符数据的Unicode字符串数据类型

    Unicode character string data types

    Data type

    Min limit

    Max limit

    nchar

    0 chars

    4000 chars

    nvarchar

    0 chars

    4000 chars

    ntext

    0 chars

    1,073,741,823 char

    Unicode字符串数据类型

    数据类型

    最低限度

    最高限额

    nchar

    0个字符

    4000个字符

    nvarchar

    0个字符

    4000个字符

    文字

    0个字符

    1,073,741,823字符

We have to take into account one point about the text and ntext data types. These data types are deprecated, and for this reason, we should try not to use these data types. We can use nvarchar(max) or varchar(max) instead.

我们必须考虑到有关textntext数据类型的一点。 这些数据类型已被弃用,因此,我们应尽量不要使用这些数据类型。 我们可以使用nvarchar(max)varchar(max)代替。

SQL string functions are used to manipulate the character expressions or to obtain various information about them. CONCAT function in SQL is one of the most useful members of these functions. CONCAT function is a SQL string function that provides to concatenate two or more than two character expressions into a single string. Now, we will go into the point with a simple example.

SQL字符串函数用于操纵字符表达式或获取有关它们的各种信息。 SQL中的CONCAT函数是这些函数中最有用的成员之一。 CONCAT函数是一个SQL字符串函数,可将两个或两个以上的字符表达式连接成一个字符串。 现在,我们将通过一个简单的例子来说明这一点。

CONCAT函数语法 (CONCAT function syntax)

The syntax of the function looks like as follows:

该函数的语法如下所示:

CONCAT ( string_value1, string_value2 [, string_valueN ] )

CONCAT(string_value1,string_value2 [,string_valueN])

The CONCAT function at least requires two parameters and this function can accept a maximum of 254 parameters.

CONCAT函数至少需要两个参数,并且该函数最多可以接受254个参数。

CONCAT功能示例 (CONCAT function examples

你可能感兴趣的:(字符串,python,java,sql,数据库)