Get the App
SLTechnology News&Howtos  ›  Database  › 

Mysql common operators and functions

Shulou Source: shulou.com Published: 2022-06-01 17:03:19 09月15日 Update

1. Common arithmetic operators

1.1 operators, functions, remarks

1.2 points for consideration

   (1) Integer (bigint) and Integer Operation (+, -,) results in bigint

   (2) floating point number and floating point number operation (/), the result of which is the product of the decimal places involved in the operation.

   (3) divided by 0 or other illegal operation results in NULL.

2. Common comparison operators

2.1BETWEEN AND

   checks whether a value is between values 1 and 2 (including values 1 and 2), SELECT 2 BETWEEN 1 AND 2 FROM DUAL

2.2COALESCE ()

   returns the first non-NULL value, SELECT COALESCE (NULL,'aa') FROM dual

2.3 =

   checks whether the values are equal.

   SELECT 1=NULL FROM DUAL

   SELECT 1 # 1 FROM DUAL

   SELECT NULL=NULL FROM dual

   SELECT (1, 2) = ('1, 2, 2) FROM dual

2.4GREATEST ()

   returns the largest parameter.

2.5IN ()

   checks whether the value is within a set of values.

2.6IS NULL

   determines whether a value is null or not.

2.7LEAST ()

   returns the minimum value.

3. Logical operator

4. Assignment operator

5. Common control flow functions

   IFNULL () returns a number or string value, depending on the context in which it is used.

6. Commonly used string functions

6.1ASCII ()

   returns the ascii value of the first character

6.2CONCAT ()

   connection string.

6.3CONCAT-WS ()

   concatenates strings with delimiters.

6.4LCASE ()

   converts uppercase letters to lowercase letters.

6.5LIKE ()

  %: zero or more characters.

   _: one character.

   returns a value containing a character.

6.6TRIM ()

   removes leading and trailing spaces.

6.7SUBSTR ()

   returns substring function

7. Mathematical function

8. Time and date function

9. Class conversion function

10. Aggregate function

Tags: Operations characters functions operators commonly used strings results checks digits letters decimals integers points maximum minimum upper and lower context between product item Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Huawei Apple MySQL OPPO Reno Xiaomi