 
  Data Structure Data Structure
 Networking Networking
 RDBMS RDBMS
 Operating System Operating System
 Java Java
 MS Excel MS Excel
 iOS iOS
 HTML HTML
 CSS CSS
 Android Android
 Python Python
 C Programming C Programming
 C++ C++
 C# C#
 MongoDB MongoDB
 MySQL MySQL
 Javascript Javascript
 PHP 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
How to suppress warnings in MySQL?
To suppress warnings, set SQL_NOTES=0. Let us see an example.
At first, we will set SQL_NOTES to 1 −
mysql> SET sql_notes = 1; Query OK, 0 rows affected (0.00 sec)
Now, let us drop a table which does not exist. As you can see a warning message is now visible −
mysql> drop table if exists web.DemoTable; Query OK, 0 rows affected, 1 warning (0.07 sec)
To look at the above warning message, you need to just use the SHOW WARNINGS command −
mysql> show warnings;
This will produce the following output displaying the warning message −
+-------+------+-----------------------------------+ | Level | Code | Message | +-------+------+-----------------------------------+ | Note | 1051 | Unknown table 'web.DemoTable' | +-------+------+-----------------------------------+ 1 row in set (0.00 sec)
Now, since we need to suppress warnings, use SQL_NOTES and set it to OFF −
mysql> SET sql_notes = 0; Query OK, 0 rows affected (0.00 sec)
Let us drop the above table once again −
mysql> drop table if exists web.DemoTable; Query OK, 0 rows affected (0.07 sec)
The above process is called suppress warning in MySQL. Now, when you will again try to fetch the warnings, it will display “Empty set” as shown below −
mysql> show warnings; Empty set (0.00 sec)
Advertisements
 