- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- MS Excel
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP
- Physics
- Chemistry
- Biology
- Mathematics
- English
- Economics
- Psychology
- Social Studies
- Fashion Studies
- Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Using ! operator in MySQL
For same results, do not use ! operator. The NOT keyword is already provided by MySQL. Let us first create a table −
mysql> create table DemoTable1560 -> ( -> Value1 int -> ); Query OK, 0 rows affected (0.50 sec)
Insert some records in the table using insert command −
mysql> insert into DemoTable1560 values(0); Query OK, 1 row affected (0.16 sec)
Display all records from the table using select statement −
mysql> select * from DemoTable1560;
This will produce the following output −
+--------+ | Value1 | +--------+ | 0 | +--------+ 1 row in set (0.00 sec)
Here is the query to use NOT keyword −
mysql> select NOT (NOT Value1), NOT NOT Value1, NOT NOT Value1 from DemoTable1560;
This will produce the following output −
+------------------+----------------+----------------+ | NOT (NOT Value1) | NOT NOT Value1 | NOT NOT Value1 | +------------------+----------------+----------------+ | 0 | 0 | 0 | +------------------+----------------+----------------+ 1 row in set (0.00 sec)
Advertisements