Krivalar Tutorials 
Krivalar Tutorials



SQL NOT Operator | Not equal

<< Previous - SQL OR OPERATOR

Next - SQL BETWEEN >>








SQL NOT operator is used to retrieve the records only if the condition is not TRUE.

Syntax


SELECT * FROM Table-name WHERE NOT condition ;

Example of NOT

Consider the above example student table in collegedb.

Following SQL statement selects the all records only if City is not 'Chennai'.


mysql> SELECT * FROM student WHERE NOT City='Chennai';
+--------+---------+------+-----------+
| RollNo | Name    | Age  | City      |
+--------+---------+------+-----------+
|      2 | Varun   |   19 | Bangalore |
|      3 | Ara     |   19 | Kerala    |
|      4 | Markdin |   18 | Mumbai    |
|      5 | Kannan  |   20 | Kerala    |
|      7 | Jose    |   19 | Kerala    |
+--------+---------+------+-----------+
5 rows in set (0.00 sec)



<< Previous - SQL OR OPERATOR

Next - SQL BETWEEN >>









Searching using Binary Search Tree