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

10 reasons why Linux is becoming more and more popular

Linux has been loved by more and more users. Why ...

Solution to the Docker container cannot be stopped and deleted

Find the running container id docker ps Find the ...

How to execute Linux shell commands in Docker

To execute a shell command in Docker, you need to...

How to redirect URL using nginx rewrite

I often need to change nginx configuration at wor...

Text pop-up effects implemented with CSS3

Achieve resultsImplementation Code html <div&g...

Disable IE Image Toolbar

I just tried it on IE6, and it does show the toolb...

Teach you how to use MySQL8 recursive method

I have previously written an article about recurs...

Vue achieves the top effect through v-show

html <div class="totop" v-show="...

Tutorial on installing MySQL database and using Navicat for MySQL

MySQL is a relational database management system ...

MySQL 5.6.33 installation and configuration tutorial under Linux

This tutorial shares the installation and configu...

Detailed explanation of the getBoundingClientRect() method in js

1. getBoundingClientRect() Analysis The getBoundi...

Detailed tutorial on how to create a user in mysql and grant user permissions

Table of contents User Management Create a new us...