SQL Tutorial (Chap11)
SQL Tutorial (Chap11)
Display the employees whose name is not ends with ‘S’ in EMP table
SQL> SELECT *FROM emp WHERE ename NOT LIKE ‘%S’;
Display the employees whose names are not having second letter as ‘L’ in EMP table
SQL>SELECT *FROM emp WHERE ename NOT LIKE ‘_L%’;
Display the employees whose names are not start with ‘S’ in EMP table.
SQL>SELECT *FROM emp WHERE ename NOT LIKE ‘S%’;
Display the employees whose names are second letter start with ‘R’ from ending.
SQL>SELECT *FROM emp WHERE ename LIKE ‘%R_’;
Examples:
Display the details of employees whose salary is not equals to 2000.
NOT IN:
‘not in’ operator is quite opposite to ‘IN’ clause.
SQL> SELECT *FROM emp WHERE empno NOT IN (7125, 7369, 7782);
NOT BETWEEN
Returns true if value specified is not within the specified range.
Supports with numbers and date values.
Not between is an exclusive operator which eliminates range limits from Output.
Example:-
SQL> SELECT *FROM emp WHERE sal NOT BETWEEN 2000 AND 3000;
Lower bound – ‘value ‘must be lower when compare to ‘upper bound ‘value
Upper bound- ‘value’ must be higher when compare to ‘lower bound ‘value
IS NOT NULL:-
-Use to search for NOT NULL values in the given input