Summary of the use of special operators in MySql

Summary of the use of special operators in MySql

Preface

There are 4 types of operators in MySQL, they are:

  • Arithmetic operators
  • Comparison Operators
  • Logical operators
  • Bitwise operators

This should be familiar to everyone, but this article summarizes the relevant content about special operators in MySQL. Let's take a look at the detailed introduction.

1. <=> safe comparison operator

In MySQL, any comparison with NULL will be NULL, which is often used to determine whether it is NULL.


Of course I can also use IS NULL


2. The role of := assignment

Both the := and = operators have the function of assigning values. In most scenarios, there is no difference between them, but := is more applicable to all scenarios.

= has the same function as := only when used for set and update, i.e. assignment. Otherwise, it functions as the relational operator equal to.

:= is not only used for setting and updating, but also for selecting. It is often used in combination with @, such as numbering.


3. @ User variables

@ is a local variable declaration. If there is no @, the field represents the column name and is used for user variable declaration.


4. @@ System variables

System variables are divided into global system variables and session system variables


Some system variables are only available at the global level, such as max_connnections. You do not need to explicitly declare global when reading, but you need to declare when setting. Otherwise, you will be prompted to set a global variable.

These are the most commonly used ones, and I will add more later. . .

Summarize

The above is the full content of this article. I hope that the content of this article will have certain reference learning value for your study or work. If you have any questions, you can leave a message to communicate. Thank you for your support for 123WORDPRESS.COM.

You may also be interested in:
  • MySQL Where conditional statement introduction and operator summary
  • Examples of operators used in MySQL
  • MySQL Notes: Detailed Explanation of Operator Usage
  • Study on the default rules of mySQL UNION operator
  • Summary of commonly used operators and functions in MySQL
  • Learning MYSQL in comparison with MSSQL (V) - Operators
  • Teach you MySQL operators step by step

<<:  Detailed explanation of CentOS7 online installation of Docker 17.03.2 using Alibaba Cloud Docker Yum source

>>:  Detailed steps to install python3.7 on CentOS6.5

Recommend

How to create a web wireframe using Photoshop

This post introduces a set of free Photoshop wire...

Detailed explanation of how to write mysql not equal to null and equal to null

1. Table structure 2. Table data 3. The query tea...

Implementing shopping cart function based on vuex

This article example shares the specific code of ...

How to install Chrome browser on CentOS 7

This article introduces how to install Chrome bro...

Detailed explanation of map overlay in openlayers6

1. Overlay Overview Overlay means covering, as th...

Detailed explanation of real-time backup knowledge points of MySQL database

Preface The need for real-time database backup is...

How to set PATH environment variable in Linux system (3 methods)

1. In Windows system, many software installations...

Detailed explanation of importing/exporting MySQL data in Docker container

Preface We all know that the import and export of...

How to make vue long list load quickly

Table of contents background Main content 1. Comp...

The most commonly used HTML escape sequence

In HTML, <, >, &, etc. have special mean...

In-depth explanation of Session and Cookie in Tomcat

Preface HTTP is a stateless communication protoco...