A string or series (string) is a finite sequence of 0 or more characters. Generally recorded as s= ' a1a2 an ' (n>=0). It is the data type that represents text in the programming language.
A string is usually used as an action object, such as finding a substring in a string, seeking a substring, inserting a substring at a point in a string, and deleting a substring. The necessary and sufficient condition for two strings to be equal is that the length is equal and the characters on each corresponding position are equal. To set P and Q to be two strings, the operation of Q for the first place in P is called pattern matching. The two most basic types of storage for a string are sequential storage and linked storage.
Let's look at the string functions in MySQL
If the length of the result is greater than the maximum value of the Max_allowed_packet system variable, the return value of the string value function is null.
For functions that operate at the string position, the first position is numbered 1.
ASCII (str)
Returns the value of the leftmost character of String Str. If Str is an empty string, the return value is 0. If STR is NULL, the return value is null. ASCII () is used for characters with numeric values ranging from 0 to 255.
mysql> SELECT ASCII('2');
-> 50
mysql> SELECT ASCII(2);
-> 50
mysql> SELECT ASCII('dx');
-> 100
See ORD () function.
BIN (N)
Returns a string representation of the binary value of n, where N is a longlong (BIGINT) number. This equates to CONV (n,10,2). If n is null, the return value is null.
mysql> SELECT BIN(12);
-> '1100'
Bit_length (str)
Returns the string str length of the binary value.
mysql> SELECT BIT_LENGTH('text');
-> 32
CHAR (N,... [USING CharSet])
CHAR () understands each parameter n as an integer that returns a string containing the character given by the code value of these integers. Null value is omitted.
mysql> SELECT CHAR(77,121,83,81,'76');
-> 'MySQL'
mysql> SELECT CHAR(77,77.3,'77.3');
-> 'MMM'