IS NOT NULL in MYSQL by R4R Team

MYSQL IS NOT NULL condition:
-Basically,The MySQL IS NULL condition is return the record with NOT NULL value in a SELECT, INSERT, UPDATE and DELETE statement.

Syntax:
SELECT * FROM table_name
WHERE expression IS NOT NULL;

Display all record of table employee:

SELECT * FROM employee;

emp_id emp_name department emp_salary
1 Aman 34000
2 Ram D2 43000
3 Ramesh D1 20000
4 John 65000
5 Sita D1 10000
6 Dinesh D2 15000


Now Display the employee record who have Department:

SELECT * FROM employee WHERE department IS NOT NULL;

emp_id emp_name department emp_salary
2 Ram D2 43000
3 Ramesh D1 20000
5 Sita D1 10000
6 Dinesh D2 15000



Leave a Comment: