System variables vs User-defined variables in MySQL?


System Variables

The system variables are tightly typed variable. These are also known as global specific variable.

The system variable can be initialized somewhere in global and contains the value of system variables until the server restarts. This value will destroy whenever you restart the MySQL server. The predefined system variable is prefixed with symbol @@.

User-defined Variable

The user defined variable is also known as session-specific variable. It is a type of loosely typed variable which can be initialized somewhere in session and contains the value of user defined variable until session ends. The user defined variable is prefixed with symbol @.

For Example:

@anyVariableName

Updated on: 30-Jul-2019

314 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements