SQL Tutorial (Chap10)
SQL Tutorial (Chap10)
This operator is used for equality test. Used to test the equality of two operands.
Example:-
Display the details of Employees whose salary is equal to 2000.
Example: Display the details of the employees whose salary is less than 3000.
SQL> SELECT * FROM emp WHERE sal < 3000
Here if you observe we got a result values whose salary is less than the operand 3000.
SQL Tutorial - Greaterthan (>) Operator
Example:
Display the details of Employees whose salary is greater than 3000
SQL> SELECT * FROM emp WHERE sal > 3000;
Example :
Display the details of Employees whose salary is less than or equal to 3000.
SQL> SELECT * FROM EMP WHERE sal <= 3000;
SQL Tutorial - Greater than or Equals to
(>=) Operator
Example:
Display the details of Employees whose salary is greater than or equal to 3000.
Examples:
Display the details of employees whose salary is not equals to 2000.
SELECT * FROM emp WHERE sal != 2000;
IN :
Returns true if value is available in given list of values
Supports with all types of data (data types)
In the below example only employees whose empno is (7125,7369,7782) are fetched.
SQL> SELECT *FROM emp WHERE empno IN (7125, 7369, 7782);
Whenever lower bound value is larger than upper bound then it shows ‘no rows selected’
Example:-
SQL> SELECT *FROM emp WHERE sal BETWEEN 3000 AND 2000;
Output:
-- No rows selected
LIKE:-
Display the employees whose name ends with ‘S’ in EMP table
SQL> SELECT * FROM emp WHERE ename LIKE ‘%S’;
Display the employees whose names are having second letter as ‘L’ in EMP table
SQL> SELECT * FROM emp WHERE ename LIKE ‘_L%’;
IS NULL:-
Used to search for NULL values In the given input
Supports with all types of data
Example:-
SQL> SELECT * FROM emp WHERE sal IS NULL;
Output:-
-- No rows selected;