SlideShare a Scribd company logo
Operator in SQL
Type of Operators
• An operator is a reserved word or a character used
primarily in an SQL statement's WHERE clause to
perform operation(s), such as comparisons and
arithmetic operations. These Operators are used to
specify conditions in an SQL statement and to serve as
conjunctions for multiple conditions in a statement.
• Arithmetic operators
• Comparison operators
• Logical operators
• Set Operators
Arithmetic Operators
• Arithmetic Operators
– Arithmetic operators are used to manipulate
numeric operands, which are columns Arithmetic
operators are used to manipulate numeric
operands, which are columns
• Types of arithmetic operators:
– Monadic Arithmetic Operators, which are namely,
• + and –
– Dyadic Arithmetic Operators, which are namely,
• /,*,+ and -
Rule:
If the value of any operand in a numeric value expression is null value, then
the result of thatnumeric value expression is the null value.
Arithmetic Operators
Operator Description Example
+ (Addition)
Adds values on either side
of the operator.
a + b will give 30
- (Subtraction)
Subtracts righthand
operand from left hand
operand.
a - b will give -10
* (Multiplication)
Multiplies values on either
side of the operator.
a * b will give 200
/ (Division)
Divides left hand operand
by right hand operand.
b / a will give 2
% (Modulus)
Divides left hand operand
by right hand operand and
returns remainder.
b % a will give 0
SQL Comparison Operators
• Assume 'variable a' holds 10 and 'variable b' holds 20, then
−
Operator Description Example
=
Checks if the values of two operands are equal or not, if yes then
condition becomes true.
(a = b) is not true.
!=
Checks if the values of two operands are equal or not, if values are
not equal then condition becomes true.
(a !=b) is true.
<>
Checks if the values of two operands are equal or not, if values are
not equal then condition becomes true.
(a <> b) is true.
>
Checks if the value of left operand is greater thanthe value of right
operand, if yes then condition becomes true.
(a > b) is not true.
<
Checks if the value of left operand is less than thevalue of right
operand, if yes then condition becomes true.
(a < b) is true.
>=
Checks if the value of left operand is greater thanor equal to the
value of right operand, if yes then condition becomes true.
(a >= b) is not true.
<=
Checks if the value of left operand is less than or equal to thevalue
of right operand, if yes then condition becomes true.
(a <= b) is true.
!<
Checks if the value of left operand is not less than thevalue of
right operand, if yes then condition becomes true.
(a !<b) is false.
!>
Checks if the value of left operand is not greater thanthe value of
right operand, if yes then condition becomes true.
(a !>b) is true
SQL Comparison Operators - Continues
• BETWEEN
The BETWEEN operator is used to search for values that are within a set of values, given the
minimum value and the maximum value.
• IN
The IN operator is used to compare a value to a list of literal values thathave been
specified.
• IS NULL
The NULL operator is used to compare a value with a NULL value.
• ALL
The ALL operator is used to compare a value to all values in another value set.
• ANY
The ANY operator is used to compare a value to anyapplicable value in the list as per the
condition.
• UNIQUE
The UNIQUE operator searches every row of a specified table for uniqueness (no
duplicates).
• EXISTS
The EXISTS operator is used to search for the presence of a row in a specified table that
meets a certain criterion.
Logical Operators
• AND
• The AND operatorallows the existenceof
multiple conditionsin an SQL statement's
WHERE clause
• NOT
• The NOT operatorreversesthemeaning
of the logical operatorwith which it is
used.Eg: NOT EXISTS,NOT BETWEEN,
NOT IN, etc. This is a negateoperator.
• OR
• The OR operatoris used to combine
multiple conditionsin an SQL statement's
WHERE clause.
Logical Operators
Set Operators
UNION -SYNTAX
UNION A U B
UNION - EXAMPLE
UNION ALL
INTERSECT
• The following statement combines the
results with the INTERSECT operator,
which returns only those rows returned by
both queries:
• SELECT empno FROM emp
INTERSECT
SELECT empno FROM oldemp;
INTERSECT - Example
MINUS
• The following statement combines results
with the MINUS operator, which returns
only rows returned by the first query but
not by the second:
• SELECT empno FROM emp
MINUS
SELECT empno FROM oldemp;
Minus - Example
• QUESTIONS?
SQL Operator.pdf

More Related Content

What's hot

Sql Constraints
Sql ConstraintsSql Constraints
Sql Constraints
I L0V3 CODING DR
 
SQL Tutorial - Basic Commands
SQL Tutorial - Basic CommandsSQL Tutorial - Basic Commands
SQL Tutorial - Basic Commands
1keydata
 
SQL
SQLSQL
Sql views
Sql viewsSql views
Sql views
arshid045
 
introdution to SQL and SQL functions
introdution to SQL and SQL functionsintrodution to SQL and SQL functions
introdution to SQL and SQL functions
farwa waqar
 
Sql tutorial
Sql tutorialSql tutorial
Sql tutorial
Rumman Ansari
 
Introduction to triggers
Introduction to triggersIntroduction to triggers
Introduction to triggers
Command Prompt., Inc
 
Relational algebra-and-relational-calculus
Relational algebra-and-relational-calculusRelational algebra-and-relational-calculus
Relational algebra-and-relational-calculus
Salman Vadsarya
 
Sql select
Sql select Sql select
Sql select
Mudasir Syed
 
Introduction to-sql
Introduction to-sqlIntroduction to-sql
Introduction to-sql
BG Java EE Course
 
SQL select statement and functions
SQL select statement and functionsSQL select statement and functions
SQL select statement and functions
Vikas Gupta
 
Introduction to structured query language (sql)
Introduction to structured query language (sql)Introduction to structured query language (sql)
Introduction to structured query language (sql)
Sabana Maharjan
 
Sql queries presentation
Sql queries presentationSql queries presentation
Sql queries presentation
NITISH KUMAR
 
Database Management - Lecture 2 - SQL select, insert, update and delete
Database Management - Lecture 2 - SQL select, insert, update and deleteDatabase Management - Lecture 2 - SQL select, insert, update and delete
Database Management - Lecture 2 - SQL select, insert, update and delete
Al-Mamun Sarkar
 
Sql Basics And Advanced
Sql Basics And AdvancedSql Basics And Advanced
Sql Basics And Advanced
rainynovember12
 
SQL select clause
SQL select clauseSQL select clause
SQL select clause
arpit bhadoriya
 
Basic sql Commands
Basic sql CommandsBasic sql Commands
Basic sql Commands
MUHAMMED MASHAHIL PUKKUNNUMMAL
 
Set operators
Set  operatorsSet  operators
ER-Model-ER Diagram
ER-Model-ER DiagramER-Model-ER Diagram
ER-Model-ER Diagram
Saranya Natarajan
 
Normalization of Data Base
Normalization of Data BaseNormalization of Data Base
Normalization of Data Base
Ravinder Kamboj
 

What's hot (20)

Sql Constraints
Sql ConstraintsSql Constraints
Sql Constraints
 
SQL Tutorial - Basic Commands
SQL Tutorial - Basic CommandsSQL Tutorial - Basic Commands
SQL Tutorial - Basic Commands
 
SQL
SQLSQL
SQL
 
Sql views
Sql viewsSql views
Sql views
 
introdution to SQL and SQL functions
introdution to SQL and SQL functionsintrodution to SQL and SQL functions
introdution to SQL and SQL functions
 
Sql tutorial
Sql tutorialSql tutorial
Sql tutorial
 
Introduction to triggers
Introduction to triggersIntroduction to triggers
Introduction to triggers
 
Relational algebra-and-relational-calculus
Relational algebra-and-relational-calculusRelational algebra-and-relational-calculus
Relational algebra-and-relational-calculus
 
Sql select
Sql select Sql select
Sql select
 
Introduction to-sql
Introduction to-sqlIntroduction to-sql
Introduction to-sql
 
SQL select statement and functions
SQL select statement and functionsSQL select statement and functions
SQL select statement and functions
 
Introduction to structured query language (sql)
Introduction to structured query language (sql)Introduction to structured query language (sql)
Introduction to structured query language (sql)
 
Sql queries presentation
Sql queries presentationSql queries presentation
Sql queries presentation
 
Database Management - Lecture 2 - SQL select, insert, update and delete
Database Management - Lecture 2 - SQL select, insert, update and deleteDatabase Management - Lecture 2 - SQL select, insert, update and delete
Database Management - Lecture 2 - SQL select, insert, update and delete
 
Sql Basics And Advanced
Sql Basics And AdvancedSql Basics And Advanced
Sql Basics And Advanced
 
SQL select clause
SQL select clauseSQL select clause
SQL select clause
 
Basic sql Commands
Basic sql CommandsBasic sql Commands
Basic sql Commands
 
Set operators
Set  operatorsSet  operators
Set operators
 
ER-Model-ER Diagram
ER-Model-ER DiagramER-Model-ER Diagram
ER-Model-ER Diagram
 
Normalization of Data Base
Normalization of Data BaseNormalization of Data Base
Normalization of Data Base
 

Similar to SQL Operator.pdf

OPERATORS OF C++
OPERATORS OF C++OPERATORS OF C++
OPERATORS OF C++
ANANT VYAS
 
c# operators
c# operatorsc# operators
c# operators
Micheal Ogundero
 
Java script session 4
Java script session 4Java script session 4
Java script session 4
Saif Ullah Dar
 
Logical Operators C/C++ language Programming
Logical Operators C/C++ language ProgrammingLogical Operators C/C++ language Programming
Logical Operators C/C++ language Programming
Nawab Developers
 
itft-Operators in java
itft-Operators in javaitft-Operators in java
itft-Operators in java
Atul Sehdev
 
Operators in Python
Operators in PythonOperators in Python
Operators in Python
Anusuya123
 
Python programming language introduction unit
Python programming language introduction unitPython programming language introduction unit
Python programming language introduction unit
michaelaaron25322
 
Operator 04 (js)
Operator 04 (js)Operator 04 (js)
Operator 04 (js)
AbhishekMondal42
 
Operators in java
Operators in javaOperators in java
Operators in java
yugandhar vadlamudi
 
Operators & Casts
Operators & CastsOperators & Casts
Operators & Casts
Raghuveer Guthikonda
 
Operators in c++
Operators in c++Operators in c++
Operators in c++
ABHIJITPATRA23
 
SPL 6 | Operators in C
SPL 6 | Operators in CSPL 6 | Operators in C
SPL 6 | Operators in C
Mohammad Imam Hossain
 
Relational and logical operators
Relational and logical operatorsRelational and logical operators
Relational and logical operators
Megha Sharma
 
4_A1208223655_21789_2_2018_04. Operators.ppt
4_A1208223655_21789_2_2018_04. Operators.ppt4_A1208223655_21789_2_2018_04. Operators.ppt
4_A1208223655_21789_2_2018_04. Operators.ppt
RithwikRanjan
 
Opeartor &amp; expression
Opeartor &amp; expressionOpeartor &amp; expression
Opeartor &amp; expression
V.V.Vanniapermal College for Women
 
Operators used in vb.net
Operators used in vb.netOperators used in vb.net
Operators used in vb.net
Jaya Kumari
 
L3 operators
L3 operatorsL3 operators
L3 operators
teach4uin
 
L3 operators
L3 operatorsL3 operators
L3 operators
teach4uin
 
L3 operators
L3 operatorsL3 operators
L3 operators
teach4uin
 
C# operators
C# operatorsC# operators

Similar to SQL Operator.pdf (20)

OPERATORS OF C++
OPERATORS OF C++OPERATORS OF C++
OPERATORS OF C++
 
c# operators
c# operatorsc# operators
c# operators
 
Java script session 4
Java script session 4Java script session 4
Java script session 4
 
Logical Operators C/C++ language Programming
Logical Operators C/C++ language ProgrammingLogical Operators C/C++ language Programming
Logical Operators C/C++ language Programming
 
itft-Operators in java
itft-Operators in javaitft-Operators in java
itft-Operators in java
 
Operators in Python
Operators in PythonOperators in Python
Operators in Python
 
Python programming language introduction unit
Python programming language introduction unitPython programming language introduction unit
Python programming language introduction unit
 
Operator 04 (js)
Operator 04 (js)Operator 04 (js)
Operator 04 (js)
 
Operators in java
Operators in javaOperators in java
Operators in java
 
Operators & Casts
Operators & CastsOperators & Casts
Operators & Casts
 
Operators in c++
Operators in c++Operators in c++
Operators in c++
 
SPL 6 | Operators in C
SPL 6 | Operators in CSPL 6 | Operators in C
SPL 6 | Operators in C
 
Relational and logical operators
Relational and logical operatorsRelational and logical operators
Relational and logical operators
 
4_A1208223655_21789_2_2018_04. Operators.ppt
4_A1208223655_21789_2_2018_04. Operators.ppt4_A1208223655_21789_2_2018_04. Operators.ppt
4_A1208223655_21789_2_2018_04. Operators.ppt
 
Opeartor &amp; expression
Opeartor &amp; expressionOpeartor &amp; expression
Opeartor &amp; expression
 
Operators used in vb.net
Operators used in vb.netOperators used in vb.net
Operators used in vb.net
 
L3 operators
L3 operatorsL3 operators
L3 operators
 
L3 operators
L3 operatorsL3 operators
L3 operators
 
L3 operators
L3 operatorsL3 operators
L3 operators
 
C# operators
C# operatorsC# operators
C# operators
 

Recently uploaded

writing about opinions about Australia the movie
writing about opinions about Australia the moviewriting about opinions about Australia the movie
writing about opinions about Australia the movie
Nicholas Montgomery
 
spot a liar (Haiqa 146).pptx Technical writhing and presentation skills
spot a liar (Haiqa 146).pptx Technical writhing and presentation skillsspot a liar (Haiqa 146).pptx Technical writhing and presentation skills
spot a liar (Haiqa 146).pptx Technical writhing and presentation skills
haiqairshad
 
BÀI TẬP BỔ TRỢ TIẾNG ANH LỚP 9 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2024-2025 - ...
BÀI TẬP BỔ TRỢ TIẾNG ANH LỚP 9 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2024-2025 - ...BÀI TẬP BỔ TRỢ TIẾNG ANH LỚP 9 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2024-2025 - ...
BÀI TẬP BỔ TRỢ TIẾNG ANH LỚP 9 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2024-2025 - ...
Nguyen Thanh Tu Collection
 
A Independência da América Espanhola LAPBOOK.pdf
A Independência da América Espanhola LAPBOOK.pdfA Independência da América Espanhola LAPBOOK.pdf
A Independência da América Espanhola LAPBOOK.pdf
Jean Carlos Nunes Paixão
 
Film vocab for eal 3 students: Australia the movie
Film vocab for eal 3 students: Australia the movieFilm vocab for eal 3 students: Australia the movie
Film vocab for eal 3 students: Australia the movie
Nicholas Montgomery
 
B. Ed Syllabus for babasaheb ambedkar education university.pdf
B. Ed Syllabus for babasaheb ambedkar education university.pdfB. Ed Syllabus for babasaheb ambedkar education university.pdf
B. Ed Syllabus for babasaheb ambedkar education university.pdf
BoudhayanBhattachari
 
คำศัพท์ คำพื้นฐานการอ่าน ภาษาอังกฤษ ระดับชั้น ม.1
คำศัพท์ คำพื้นฐานการอ่าน ภาษาอังกฤษ ระดับชั้น ม.1คำศัพท์ คำพื้นฐานการอ่าน ภาษาอังกฤษ ระดับชั้น ม.1
คำศัพท์ คำพื้นฐานการอ่าน ภาษาอังกฤษ ระดับชั้น ม.1
สมใจ จันสุกสี
 
Constructing Your Course Container for Effective Communication
Constructing Your Course Container for Effective CommunicationConstructing Your Course Container for Effective Communication
Constructing Your Course Container for Effective Communication
Chevonnese Chevers Whyte, MBA, B.Sc.
 
Bed Making ( Introduction, Purpose, Types, Articles, Scientific principles, N...
Bed Making ( Introduction, Purpose, Types, Articles, Scientific principles, N...Bed Making ( Introduction, Purpose, Types, Articles, Scientific principles, N...
Bed Making ( Introduction, Purpose, Types, Articles, Scientific principles, N...
Leena Ghag-Sakpal
 
Advanced Java[Extra Concepts, Not Difficult].docx
Advanced Java[Extra Concepts, Not Difficult].docxAdvanced Java[Extra Concepts, Not Difficult].docx
Advanced Java[Extra Concepts, Not Difficult].docx
adhitya5119
 
Wound healing PPT
Wound healing PPTWound healing PPT
Wound healing PPT
Jyoti Chand
 
How to Create a More Engaging and Human Online Learning Experience
How to Create a More Engaging and Human Online Learning Experience How to Create a More Engaging and Human Online Learning Experience
How to Create a More Engaging and Human Online Learning Experience
Wahiba Chair Training & Consulting
 
Main Java[All of the Base Concepts}.docx
Main Java[All of the Base Concepts}.docxMain Java[All of the Base Concepts}.docx
Main Java[All of the Base Concepts}.docx
adhitya5119
 
Solutons Maths Escape Room Spatial .pptx
Solutons Maths Escape Room Spatial .pptxSolutons Maths Escape Room Spatial .pptx
Solutons Maths Escape Room Spatial .pptx
spdendr
 
Beyond Degrees - Empowering the Workforce in the Context of Skills-First.pptx
Beyond Degrees - Empowering the Workforce in the Context of Skills-First.pptxBeyond Degrees - Empowering the Workforce in the Context of Skills-First.pptx
Beyond Degrees - Empowering the Workforce in the Context of Skills-First.pptx
EduSkills OECD
 
The basics of sentences session 6pptx.pptx
The basics of sentences session 6pptx.pptxThe basics of sentences session 6pptx.pptx
The basics of sentences session 6pptx.pptx
heathfieldcps1
 
NEWSPAPERS - QUESTION 1 - REVISION POWERPOINT.pptx
NEWSPAPERS - QUESTION 1 - REVISION POWERPOINT.pptxNEWSPAPERS - QUESTION 1 - REVISION POWERPOINT.pptx
NEWSPAPERS - QUESTION 1 - REVISION POWERPOINT.pptx
iammrhaywood
 
Présentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptx
Présentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptxPrésentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptx
Présentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptx
siemaillard
 
How to deliver Powerpoint Presentations.pptx
How to deliver Powerpoint  Presentations.pptxHow to deliver Powerpoint  Presentations.pptx
How to deliver Powerpoint Presentations.pptx
HajraNaeem15
 
BBR 2024 Summer Sessions Interview Training
BBR  2024 Summer Sessions Interview TrainingBBR  2024 Summer Sessions Interview Training
BBR 2024 Summer Sessions Interview Training
Katrina Pritchard
 

Recently uploaded (20)

writing about opinions about Australia the movie
writing about opinions about Australia the moviewriting about opinions about Australia the movie
writing about opinions about Australia the movie
 
spot a liar (Haiqa 146).pptx Technical writhing and presentation skills
spot a liar (Haiqa 146).pptx Technical writhing and presentation skillsspot a liar (Haiqa 146).pptx Technical writhing and presentation skills
spot a liar (Haiqa 146).pptx Technical writhing and presentation skills
 
BÀI TẬP BỔ TRỢ TIẾNG ANH LỚP 9 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2024-2025 - ...
BÀI TẬP BỔ TRỢ TIẾNG ANH LỚP 9 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2024-2025 - ...BÀI TẬP BỔ TRỢ TIẾNG ANH LỚP 9 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2024-2025 - ...
BÀI TẬP BỔ TRỢ TIẾNG ANH LỚP 9 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2024-2025 - ...
 
A Independência da América Espanhola LAPBOOK.pdf
A Independência da América Espanhola LAPBOOK.pdfA Independência da América Espanhola LAPBOOK.pdf
A Independência da América Espanhola LAPBOOK.pdf
 
Film vocab for eal 3 students: Australia the movie
Film vocab for eal 3 students: Australia the movieFilm vocab for eal 3 students: Australia the movie
Film vocab for eal 3 students: Australia the movie
 
B. Ed Syllabus for babasaheb ambedkar education university.pdf
B. Ed Syllabus for babasaheb ambedkar education university.pdfB. Ed Syllabus for babasaheb ambedkar education university.pdf
B. Ed Syllabus for babasaheb ambedkar education university.pdf
 
คำศัพท์ คำพื้นฐานการอ่าน ภาษาอังกฤษ ระดับชั้น ม.1
คำศัพท์ คำพื้นฐานการอ่าน ภาษาอังกฤษ ระดับชั้น ม.1คำศัพท์ คำพื้นฐานการอ่าน ภาษาอังกฤษ ระดับชั้น ม.1
คำศัพท์ คำพื้นฐานการอ่าน ภาษาอังกฤษ ระดับชั้น ม.1
 
Constructing Your Course Container for Effective Communication
Constructing Your Course Container for Effective CommunicationConstructing Your Course Container for Effective Communication
Constructing Your Course Container for Effective Communication
 
Bed Making ( Introduction, Purpose, Types, Articles, Scientific principles, N...
Bed Making ( Introduction, Purpose, Types, Articles, Scientific principles, N...Bed Making ( Introduction, Purpose, Types, Articles, Scientific principles, N...
Bed Making ( Introduction, Purpose, Types, Articles, Scientific principles, N...
 
Advanced Java[Extra Concepts, Not Difficult].docx
Advanced Java[Extra Concepts, Not Difficult].docxAdvanced Java[Extra Concepts, Not Difficult].docx
Advanced Java[Extra Concepts, Not Difficult].docx
 
Wound healing PPT
Wound healing PPTWound healing PPT
Wound healing PPT
 
How to Create a More Engaging and Human Online Learning Experience
How to Create a More Engaging and Human Online Learning Experience How to Create a More Engaging and Human Online Learning Experience
How to Create a More Engaging and Human Online Learning Experience
 
Main Java[All of the Base Concepts}.docx
Main Java[All of the Base Concepts}.docxMain Java[All of the Base Concepts}.docx
Main Java[All of the Base Concepts}.docx
 
Solutons Maths Escape Room Spatial .pptx
Solutons Maths Escape Room Spatial .pptxSolutons Maths Escape Room Spatial .pptx
Solutons Maths Escape Room Spatial .pptx
 
Beyond Degrees - Empowering the Workforce in the Context of Skills-First.pptx
Beyond Degrees - Empowering the Workforce in the Context of Skills-First.pptxBeyond Degrees - Empowering the Workforce in the Context of Skills-First.pptx
Beyond Degrees - Empowering the Workforce in the Context of Skills-First.pptx
 
The basics of sentences session 6pptx.pptx
The basics of sentences session 6pptx.pptxThe basics of sentences session 6pptx.pptx
The basics of sentences session 6pptx.pptx
 
NEWSPAPERS - QUESTION 1 - REVISION POWERPOINT.pptx
NEWSPAPERS - QUESTION 1 - REVISION POWERPOINT.pptxNEWSPAPERS - QUESTION 1 - REVISION POWERPOINT.pptx
NEWSPAPERS - QUESTION 1 - REVISION POWERPOINT.pptx
 
Présentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptx
Présentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptxPrésentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptx
Présentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptx
 
How to deliver Powerpoint Presentations.pptx
How to deliver Powerpoint  Presentations.pptxHow to deliver Powerpoint  Presentations.pptx
How to deliver Powerpoint Presentations.pptx
 
BBR 2024 Summer Sessions Interview Training
BBR  2024 Summer Sessions Interview TrainingBBR  2024 Summer Sessions Interview Training
BBR 2024 Summer Sessions Interview Training
 

SQL Operator.pdf

  • 2. Type of Operators • An operator is a reserved word or a character used primarily in an SQL statement's WHERE clause to perform operation(s), such as comparisons and arithmetic operations. These Operators are used to specify conditions in an SQL statement and to serve as conjunctions for multiple conditions in a statement. • Arithmetic operators • Comparison operators • Logical operators • Set Operators
  • 3. Arithmetic Operators • Arithmetic Operators – Arithmetic operators are used to manipulate numeric operands, which are columns Arithmetic operators are used to manipulate numeric operands, which are columns • Types of arithmetic operators: – Monadic Arithmetic Operators, which are namely, • + and – – Dyadic Arithmetic Operators, which are namely, • /,*,+ and - Rule: If the value of any operand in a numeric value expression is null value, then the result of thatnumeric value expression is the null value.
  • 4. Arithmetic Operators Operator Description Example + (Addition) Adds values on either side of the operator. a + b will give 30 - (Subtraction) Subtracts righthand operand from left hand operand. a - b will give -10 * (Multiplication) Multiplies values on either side of the operator. a * b will give 200 / (Division) Divides left hand operand by right hand operand. b / a will give 2 % (Modulus) Divides left hand operand by right hand operand and returns remainder. b % a will give 0
  • 5. SQL Comparison Operators • Assume 'variable a' holds 10 and 'variable b' holds 20, then − Operator Description Example = Checks if the values of two operands are equal or not, if yes then condition becomes true. (a = b) is not true. != Checks if the values of two operands are equal or not, if values are not equal then condition becomes true. (a !=b) is true. <> Checks if the values of two operands are equal or not, if values are not equal then condition becomes true. (a <> b) is true. > Checks if the value of left operand is greater thanthe value of right operand, if yes then condition becomes true. (a > b) is not true. < Checks if the value of left operand is less than thevalue of right operand, if yes then condition becomes true. (a < b) is true. >= Checks if the value of left operand is greater thanor equal to the value of right operand, if yes then condition becomes true. (a >= b) is not true. <= Checks if the value of left operand is less than or equal to thevalue of right operand, if yes then condition becomes true. (a <= b) is true. !< Checks if the value of left operand is not less than thevalue of right operand, if yes then condition becomes true. (a !<b) is false. !> Checks if the value of left operand is not greater thanthe value of right operand, if yes then condition becomes true. (a !>b) is true
  • 6. SQL Comparison Operators - Continues • BETWEEN The BETWEEN operator is used to search for values that are within a set of values, given the minimum value and the maximum value. • IN The IN operator is used to compare a value to a list of literal values thathave been specified. • IS NULL The NULL operator is used to compare a value with a NULL value. • ALL The ALL operator is used to compare a value to all values in another value set. • ANY The ANY operator is used to compare a value to anyapplicable value in the list as per the condition. • UNIQUE The UNIQUE operator searches every row of a specified table for uniqueness (no duplicates). • EXISTS The EXISTS operator is used to search for the presence of a row in a specified table that meets a certain criterion.
  • 7. Logical Operators • AND • The AND operatorallows the existenceof multiple conditionsin an SQL statement's WHERE clause • NOT • The NOT operatorreversesthemeaning of the logical operatorwith which it is used.Eg: NOT EXISTS,NOT BETWEEN, NOT IN, etc. This is a negateoperator. • OR • The OR operatoris used to combine multiple conditionsin an SQL statement's WHERE clause.
  • 14. INTERSECT • The following statement combines the results with the INTERSECT operator, which returns only those rows returned by both queries: • SELECT empno FROM emp INTERSECT SELECT empno FROM oldemp;
  • 16. MINUS • The following statement combines results with the MINUS operator, which returns only rows returned by the first query but not by the second: • SELECT empno FROM emp MINUS SELECT empno FROM oldemp;