Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
129 views

Operators in SQL

Operators are used to express conditions in SQL statements and manipulate data items called operands or arguments. There are several types of SQL operators including relational, arithmetic, logical, special, boolean, and concatenation operators. Relational operators like equals (=), not equals (<>), greater than (>) and less than (<) are used to test relationships between operands. Logical operators like AND and OR are used to combine conditional statements. Arithmetic operators like addition, subtraction, multiplication and division are used to perform math operations on numeric operands.

Uploaded by

venkat manoj
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
129 views

Operators in SQL

Operators are used to express conditions in SQL statements and manipulate data items called operands or arguments. There are several types of SQL operators including relational, arithmetic, logical, special, boolean, and concatenation operators. Relational operators like equals (=), not equals (<>), greater than (>) and less than (<) are used to test relationships between operands. Logical operators like AND and OR are used to combine conditional statements. Arithmetic operators like addition, subtraction, multiplication and division are used to perform math operations on numeric operands.

Uploaded by

venkat manoj
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 2

OPERATORS:-

-operators are used to express the conditions in sql statements.


-operators manipulates individual items and the returns a result
-The data items are calleed as operands or arguments
-operators arae represented by special chaaaarecters or key words
-oracle sql also supports set operators.

TYPES OF SQL OPERATORS:-


-Relational operators
-arithmetic operators
-logical operators
-special operotors
-boolean operators
-concatenation operators.
-----------------------------------------------------------------------------------
------
Relational operators:-
Equals to(=) operator:-
---------------------
-This operator is used to equality test.
-used to test the equality of two operands.
Ex:-
Display the details of employees whose salary is equal to 2000
SQL>SELECT* FROM employees where salary=2000;
Less than or equal to operator(<=):-
---------------------
-used for less tthan test between two operands.
Ex:-
Select * from employees where salary<=3000;
Greater than or equal to operator(>):-
-------------------------
-used for greater than test
- Ex:-
select * from employees where salary>=3000;
NotEqual to operator:-
---------------------
Not equals to (!= or ^= or <>)
ex:-
select * from employees where salary !=3000;
IN operator:-
------------
-returns true value if value is available in given list of values
-supports all types of data types
select * from employees where employee_id in(103,105,108)'
LIKE operator:-
-------------
-Used to search for pattern in a given input.
-it is supprted with charecter data only
-It uses two meta charecters.
% And _ are meta operators.
-% represents 'zero or more charecters'.
_ represents 'one charecter'
Syntax:-select * from emp where ename like '%S';(ename starts with s)
ENAME
-----
SMITH
Scott
SHIVA
select * from emp where ename like 'S%';(ename ends with s)
ENAME
-----
JONEs
ADAMs
JAMEs
select * from emp where ename like '_L%';(enames having l as 2nd
letter)
ename
-----
AlLEN
BlAKE
ClARK
IS NULL operator:-
----------------
-Used to search for NULL values in the input
-supports all types of data/
Syntax:-SELECT * FROM emp WHERE salary IS NULL;
CONCATENATION operator(||):-
----------------------
-Used in expressions to manipulate charecter strings
Ex:-'The name of employee is:'||ename
-----------------------------------------------------------------------------------
------
'LOGICAL OPERATORS':-
"AND" operators:-
-returns 'true' if both the components are true and 'false' if any of the condition
fail or both
Ex:- SELECT * FROM emp where sal>1000 AND sal<2000;
"OR" operator:-
-Returns true if the any of the condition is true,false if both are false
ex:-SELECT * from emp where sal>800 or sal>7000
'NOT' operator:-
-returns true if the condition is false
-returns false if the condition is true
-----------------------------------------------------------------------------------
---------
Arithmetic operators:-
Multiplication operator:-
-----------------------
Syntax:- SQL>select sal*2 from emp;
Division operator:-
Syntax:-SQL>select sal,sal/2 from emp;
Addition operator:-
Syntax:-SQL>select e.sal+2000 from emp e;
substraction operator:-
Syntax:-SQL>select sal-200 from emp;

You might also like