
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
List All Variables Initialized by SET Operator in MySQL
To list all variables initialized by SET operator, the syntax is as follows −
select * from performance_schema.user_variables_by_thread;
Here is the query to set the variable −
mysql> set @FirstName='John'; Query OK, 0 rows affected (0.00 sec) mysql> set @LastName='Doe'; Query OK, 0 rows affected (0.00 sec)
Here is the query to display the list of all variables initialized by SET operator. This list includes the variables set above −
mysql> select * from performance_schema.user_variables_by_thread;
This will produce the following output −
+-----------+---------------+----------------+ | THREAD_ID | VARIABLE_NAME | VARIABLE_VALUE | +-----------+---------------+----------------+ | 120 | TotalAmount | 5000 | | 120 | FirstName | John | | 120 | lName | Smith | | 120 | fName | Adam | | 120 | LastName | Doe | +-----------+---------------+----------------+ 5 rows in set (0.00 sec)
Advertisements