SlideShare a Scribd company logo
1 of 11
Topic Name :
SQL Operators
Presented By:
Mrs. U. S. Patil
Assistant Professor,
SIT COE Yadrav Ichalkranji.
SQL 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
Mrs U. S. Patil , SITCOE Yadrav 2
Arithmetic Operators:
These operators are used to perform operations such as addition, multiplication,
subtraction etc
Mrs U. S. Patil , SITCOE Yadrav 3
Operator Operation Description
+ Addition Add values on either side of the operator
– Subtraction
Used to subtract the right hand side value from the left hand
side value
* Multiplication Multiples the values present on each side of the operator
/ Division Divides the left hand side value by the right hand side value
% Modulus
Divides the left hand side value by the right hand side value;
and returns the remainder
Comparison Operators:
These operators are used to perform operations such as equal to,
greater than, less than etc.
Mrs U. S. Patil , SITCOE Yadrav 4
Operator Operation Description
= Equal to
Used to check if the values of both operands are equal or not. If they are
equal, then it returns TRUE.
> Greater than
Returns TRUE if the value of left operand is greater than the right
operand.
< Less than
Checks whether the value of left operand is less than the right operand, if
yes returns TRUE.
>= Greater than or equal to
Used to check if the left operand is greater than or equal to the right
operand, and returns TRUE, if the condition is true.
<= Less than or equal to
Returns TRUE if the left operand is less than or equal to the right
operand.
<> or != Not equal to
Used to check if values of operands are equal or not. If they are not equal
then, it returns TRUE.
!> Not greater than
Checks whether the left operand is not greater than the right operand, if
yes then returns TRUE.
!< Not less than Returns TRUE, if the left operand is not less than the right operand.
Logical Operator:
Mrs U. S. Patil , SITCOE Yadrav 5
Operator Description
AND Allows the user to mention multiple conditions in a WHERE clause.
OR Combines multiple conditions in a WHERE clause.
NOT A negate operators, used to reverse the output of the logical operator.
Range Searching operators- 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.
Consider the following Student Table:
Example: SELECT * FROM Students WHERE Age BETWEEN 22 AND 25;
Output:
Mrs U. S. Patil , SITCOE Yadrav 6
StudentID FirstName LastName Age
1 Atul Mishra 23
2 Priya Kapoor 21
3 Rohan Singhania 21
4 Akanksha Jain 20
5 Vaibhav Gupta 25
StudentID FirstName LastName Age
1 Atul Mishra 23
Pattern Matching Operator- Like
This operator is used along with the WHERE clause to retrieve the data
according to a specific pattern. There are two wildcards which are used along
with the LIKE operator to retrieve data. They are:
• %[Percentage Sign] – It matches 0 or more character.
• _ [Underscore]– It matches exactly one character.
Syntax:
SELECT column1, coulmn2, . . ., columnN FROM tablename
WHERE columnName LIKE pattern;
Mrs U. S. Patil , SITCOE Yadrav 7
Consider the following table on which we will apply various
operations of the LIKE operator.
Example: Select all students starting with “a”
SELECT * FROM students WHERE studentname LIKE 'a%';
Output:
Mrs U. S. Patil , SITCOE Yadrav 8
studentID studentname
1 akash
2 mitali
3 sanjay
4 anuj
5 sonali
studentID studentname
1 akash
4 anuj
Mrs U. S. Patil , SITCOE Yadrav 9
Example 2: Select all students with a studentname ending with “i”
SELECT * FROM students WHERE studentname LIKE '%i';
Output:
Example 3: Select all students with a studentname that have “o” in the
second position:
SELECT * FROM students WHERE studentname LIKE '_o%';
Output:
studentID studentname
2 mitali
5 sonali
studentID studentname
5 sonali
Example 4: Select all students with a studentname that start with “a” and
are at least 5 characters in length
SELECT * FROM students WHERE studentname LIKE 'a____%';
Output:
Example 5: Select all students with a studentname that start with “s” and
end with “y”
SELECT * FROM students WHERE studentname LIKE 's%y';
Output:
Mrs U. S. Patil , SITCOE Yadrav 10
studentID studentname
1 akash
studentID studentname
3 sanjay
Mrs U. S. Patil , SITCOE Yadrav 11

More Related Content

Similar to SQL Operators.pptx

OCA Java SE 8 Exam Chapter 2 Operators & Statements
OCA Java SE 8 Exam Chapter 2 Operators & StatementsOCA Java SE 8 Exam Chapter 2 Operators & Statements
OCA Java SE 8 Exam Chapter 2 Operators & Statementsİbrahim Kürce
 
1Create a correlation table for the variables in our data set. (Us.docx
1Create a correlation table for the variables in our data set. (Us.docx1Create a correlation table for the variables in our data set. (Us.docx
1Create a correlation table for the variables in our data set. (Us.docxjeanettehully
 
Basics of SELECT Statement - Oracle SQL
Basics of SELECT Statement - Oracle SQL Basics of SELECT Statement - Oracle SQL
Basics of SELECT Statement - Oracle SQL MuhammadWaheed44
 
lecture4 pgdca.pptx
lecture4 pgdca.pptxlecture4 pgdca.pptx
lecture4 pgdca.pptxclassall
 
Project in TLE
Project in TLEProject in TLE
Project in TLEPGT_13
 
Report Group 4 Constants and Variables
Report Group 4 Constants and VariablesReport Group 4 Constants and Variables
Report Group 4 Constants and VariablesGenard Briane Ancero
 
Report Group 4 Constants and Variables(TLE)
Report Group 4 Constants and Variables(TLE)Report Group 4 Constants and Variables(TLE)
Report Group 4 Constants and Variables(TLE)Genard Briane Ancero
 
This slide contains information about Operators in C.pptx
This slide contains information about Operators in C.pptxThis slide contains information about Operators in C.pptx
This slide contains information about Operators in C.pptxranaashutosh531pvt
 
Chinabankppt
ChinabankpptChinabankppt
Chinabankpptnewrforce
 
Operators in Python
Operators in PythonOperators in Python
Operators in PythonAnusuya123
 
Shubhrat operator &amp; expression
Shubhrat operator &amp; expressionShubhrat operator &amp; expression
Shubhrat operator &amp; expressionShubhrat Mishra
 
OPERATORS OF C++
OPERATORS OF C++OPERATORS OF C++
OPERATORS OF C++ANANT VYAS
 

Similar to SQL Operators.pptx (20)

Module03
Module03Module03
Module03
 
OCA Java SE 8 Exam Chapter 2 Operators & Statements
OCA Java SE 8 Exam Chapter 2 Operators & StatementsOCA Java SE 8 Exam Chapter 2 Operators & Statements
OCA Java SE 8 Exam Chapter 2 Operators & Statements
 
1Create a correlation table for the variables in our data set. (Us.docx
1Create a correlation table for the variables in our data set. (Us.docx1Create a correlation table for the variables in our data set. (Us.docx
1Create a correlation table for the variables in our data set. (Us.docx
 
Les18
Les18Les18
Les18
 
0808.pdf
0808.pdf0808.pdf
0808.pdf
 
0808.pdf
0808.pdf0808.pdf
0808.pdf
 
Basics of SELECT Statement - Oracle SQL
Basics of SELECT Statement - Oracle SQL Basics of SELECT Statement - Oracle SQL
Basics of SELECT Statement - Oracle SQL
 
SQL- Introduction to MySQL
SQL- Introduction to MySQLSQL- Introduction to MySQL
SQL- Introduction to MySQL
 
lecture4 pgdca.pptx
lecture4 pgdca.pptxlecture4 pgdca.pptx
lecture4 pgdca.pptx
 
Project in TLE
Project in TLEProject in TLE
Project in TLE
 
Report Group 4 Constants and Variables
Report Group 4 Constants and VariablesReport Group 4 Constants and Variables
Report Group 4 Constants and Variables
 
Report Group 4 Constants and Variables(TLE)
Report Group 4 Constants and Variables(TLE)Report Group 4 Constants and Variables(TLE)
Report Group 4 Constants and Variables(TLE)
 
This slide contains information about Operators in C.pptx
This slide contains information about Operators in C.pptxThis slide contains information about Operators in C.pptx
This slide contains information about Operators in C.pptx
 
Guide to Java.pptx
Guide to Java.pptxGuide to Java.pptx
Guide to Java.pptx
 
Chinabankppt
ChinabankpptChinabankppt
Chinabankppt
 
Relational model
Relational modelRelational model
Relational model
 
Operators in Python
Operators in PythonOperators in Python
Operators in Python
 
Shubhrat operator &amp; expression
Shubhrat operator &amp; expressionShubhrat operator &amp; expression
Shubhrat operator &amp; expression
 
5_Operators.pdf
5_Operators.pdf5_Operators.pdf
5_Operators.pdf
 
OPERATORS OF C++
OPERATORS OF C++OPERATORS OF C++
OPERATORS OF C++
 

Recently uploaded

Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptxDecoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptxJoão Esperancinha
 
An experimental study in using natural admixture as an alternative for chemic...
An experimental study in using natural admixture as an alternative for chemic...An experimental study in using natural admixture as an alternative for chemic...
An experimental study in using natural admixture as an alternative for chemic...Chandu841456
 
computer application and construction management
computer application and construction managementcomputer application and construction management
computer application and construction managementMariconPadriquez1
 
Software and Systems Engineering Standards: Verification and Validation of Sy...
Software and Systems Engineering Standards: Verification and Validation of Sy...Software and Systems Engineering Standards: Verification and Validation of Sy...
Software and Systems Engineering Standards: Verification and Validation of Sy...VICTOR MAESTRE RAMIREZ
 
Oxy acetylene welding presentation note.
Oxy acetylene welding presentation note.Oxy acetylene welding presentation note.
Oxy acetylene welding presentation note.eptoze12
 
CCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdf
CCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdfCCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdf
CCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdfAsst.prof M.Gokilavani
 
INFLUENCE OF NANOSILICA ON THE PROPERTIES OF CONCRETE
INFLUENCE OF NANOSILICA ON THE PROPERTIES OF CONCRETEINFLUENCE OF NANOSILICA ON THE PROPERTIES OF CONCRETE
INFLUENCE OF NANOSILICA ON THE PROPERTIES OF CONCRETEroselinkalist12
 
Biology for Computer Engineers Course Handout.pptx
Biology for Computer Engineers Course Handout.pptxBiology for Computer Engineers Course Handout.pptx
Biology for Computer Engineers Course Handout.pptxDeepakSakkari2
 
IVE Industry Focused Event - Defence Sector 2024
IVE Industry Focused Event - Defence Sector 2024IVE Industry Focused Event - Defence Sector 2024
IVE Industry Focused Event - Defence Sector 2024Mark Billinghurst
 
Sachpazis Costas: Geotechnical Engineering: A student's Perspective Introduction
Sachpazis Costas: Geotechnical Engineering: A student's Perspective IntroductionSachpazis Costas: Geotechnical Engineering: A student's Perspective Introduction
Sachpazis Costas: Geotechnical Engineering: A student's Perspective IntroductionDr.Costas Sachpazis
 
Introduction to Machine Learning Unit-3 for II MECH
Introduction to Machine Learning Unit-3 for II MECHIntroduction to Machine Learning Unit-3 for II MECH
Introduction to Machine Learning Unit-3 for II MECHC Sai Kiran
 
Correctly Loading Incremental Data at Scale
Correctly Loading Incremental Data at ScaleCorrectly Loading Incremental Data at Scale
Correctly Loading Incremental Data at ScaleAlluxio, Inc.
 
Architect Hassan Khalil Portfolio for 2024
Architect Hassan Khalil Portfolio for 2024Architect Hassan Khalil Portfolio for 2024
Architect Hassan Khalil Portfolio for 2024hassan khalil
 
Application of Residue Theorem to evaluate real integrations.pptx
Application of Residue Theorem to evaluate real integrations.pptxApplication of Residue Theorem to evaluate real integrations.pptx
Application of Residue Theorem to evaluate real integrations.pptx959SahilShah
 
8251 universal synchronous asynchronous receiver transmitter
8251 universal synchronous asynchronous receiver transmitter8251 universal synchronous asynchronous receiver transmitter
8251 universal synchronous asynchronous receiver transmitterShivangiSharma879191
 
An introduction to Semiconductor and its types.pptx
An introduction to Semiconductor and its types.pptxAn introduction to Semiconductor and its types.pptx
An introduction to Semiconductor and its types.pptxPurva Nikam
 

Recently uploaded (20)

Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptxDecoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
 
An experimental study in using natural admixture as an alternative for chemic...
An experimental study in using natural admixture as an alternative for chemic...An experimental study in using natural admixture as an alternative for chemic...
An experimental study in using natural admixture as an alternative for chemic...
 
Call Us -/9953056974- Call Girls In Vikaspuri-/- Delhi NCR
Call Us -/9953056974- Call Girls In Vikaspuri-/- Delhi NCRCall Us -/9953056974- Call Girls In Vikaspuri-/- Delhi NCR
Call Us -/9953056974- Call Girls In Vikaspuri-/- Delhi NCR
 
computer application and construction management
computer application and construction managementcomputer application and construction management
computer application and construction management
 
Software and Systems Engineering Standards: Verification and Validation of Sy...
Software and Systems Engineering Standards: Verification and Validation of Sy...Software and Systems Engineering Standards: Verification and Validation of Sy...
Software and Systems Engineering Standards: Verification and Validation of Sy...
 
Oxy acetylene welding presentation note.
Oxy acetylene welding presentation note.Oxy acetylene welding presentation note.
Oxy acetylene welding presentation note.
 
CCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdf
CCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdfCCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdf
CCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdf
 
INFLUENCE OF NANOSILICA ON THE PROPERTIES OF CONCRETE
INFLUENCE OF NANOSILICA ON THE PROPERTIES OF CONCRETEINFLUENCE OF NANOSILICA ON THE PROPERTIES OF CONCRETE
INFLUENCE OF NANOSILICA ON THE PROPERTIES OF CONCRETE
 
Biology for Computer Engineers Course Handout.pptx
Biology for Computer Engineers Course Handout.pptxBiology for Computer Engineers Course Handout.pptx
Biology for Computer Engineers Course Handout.pptx
 
IVE Industry Focused Event - Defence Sector 2024
IVE Industry Focused Event - Defence Sector 2024IVE Industry Focused Event - Defence Sector 2024
IVE Industry Focused Event - Defence Sector 2024
 
young call girls in Green Park🔝 9953056974 🔝 escort Service
young call girls in Green Park🔝 9953056974 🔝 escort Serviceyoung call girls in Green Park🔝 9953056974 🔝 escort Service
young call girls in Green Park🔝 9953056974 🔝 escort Service
 
Sachpazis Costas: Geotechnical Engineering: A student's Perspective Introduction
Sachpazis Costas: Geotechnical Engineering: A student's Perspective IntroductionSachpazis Costas: Geotechnical Engineering: A student's Perspective Introduction
Sachpazis Costas: Geotechnical Engineering: A student's Perspective Introduction
 
Introduction to Machine Learning Unit-3 for II MECH
Introduction to Machine Learning Unit-3 for II MECHIntroduction to Machine Learning Unit-3 for II MECH
Introduction to Machine Learning Unit-3 for II MECH
 
Correctly Loading Incremental Data at Scale
Correctly Loading Incremental Data at ScaleCorrectly Loading Incremental Data at Scale
Correctly Loading Incremental Data at Scale
 
POWER SYSTEMS-1 Complete notes examples
POWER SYSTEMS-1 Complete notes  examplesPOWER SYSTEMS-1 Complete notes  examples
POWER SYSTEMS-1 Complete notes examples
 
🔝9953056974🔝!!-YOUNG call girls in Rajendra Nagar Escort rvice Shot 2000 nigh...
🔝9953056974🔝!!-YOUNG call girls in Rajendra Nagar Escort rvice Shot 2000 nigh...🔝9953056974🔝!!-YOUNG call girls in Rajendra Nagar Escort rvice Shot 2000 nigh...
🔝9953056974🔝!!-YOUNG call girls in Rajendra Nagar Escort rvice Shot 2000 nigh...
 
Architect Hassan Khalil Portfolio for 2024
Architect Hassan Khalil Portfolio for 2024Architect Hassan Khalil Portfolio for 2024
Architect Hassan Khalil Portfolio for 2024
 
Application of Residue Theorem to evaluate real integrations.pptx
Application of Residue Theorem to evaluate real integrations.pptxApplication of Residue Theorem to evaluate real integrations.pptx
Application of Residue Theorem to evaluate real integrations.pptx
 
8251 universal synchronous asynchronous receiver transmitter
8251 universal synchronous asynchronous receiver transmitter8251 universal synchronous asynchronous receiver transmitter
8251 universal synchronous asynchronous receiver transmitter
 
An introduction to Semiconductor and its types.pptx
An introduction to Semiconductor and its types.pptxAn introduction to Semiconductor and its types.pptx
An introduction to Semiconductor and its types.pptx
 

SQL Operators.pptx

  • 1. Topic Name : SQL Operators Presented By: Mrs. U. S. Patil Assistant Professor, SIT COE Yadrav Ichalkranji.
  • 2. SQL 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 Mrs U. S. Patil , SITCOE Yadrav 2
  • 3. Arithmetic Operators: These operators are used to perform operations such as addition, multiplication, subtraction etc Mrs U. S. Patil , SITCOE Yadrav 3 Operator Operation Description + Addition Add values on either side of the operator – Subtraction Used to subtract the right hand side value from the left hand side value * Multiplication Multiples the values present on each side of the operator / Division Divides the left hand side value by the right hand side value % Modulus Divides the left hand side value by the right hand side value; and returns the remainder
  • 4. Comparison Operators: These operators are used to perform operations such as equal to, greater than, less than etc. Mrs U. S. Patil , SITCOE Yadrav 4 Operator Operation Description = Equal to Used to check if the values of both operands are equal or not. If they are equal, then it returns TRUE. > Greater than Returns TRUE if the value of left operand is greater than the right operand. < Less than Checks whether the value of left operand is less than the right operand, if yes returns TRUE. >= Greater than or equal to Used to check if the left operand is greater than or equal to the right operand, and returns TRUE, if the condition is true. <= Less than or equal to Returns TRUE if the left operand is less than or equal to the right operand. <> or != Not equal to Used to check if values of operands are equal or not. If they are not equal then, it returns TRUE. !> Not greater than Checks whether the left operand is not greater than the right operand, if yes then returns TRUE. !< Not less than Returns TRUE, if the left operand is not less than the right operand.
  • 5. Logical Operator: Mrs U. S. Patil , SITCOE Yadrav 5 Operator Description AND Allows the user to mention multiple conditions in a WHERE clause. OR Combines multiple conditions in a WHERE clause. NOT A negate operators, used to reverse the output of the logical operator.
  • 6. Range Searching operators- 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. Consider the following Student Table: Example: SELECT * FROM Students WHERE Age BETWEEN 22 AND 25; Output: Mrs U. S. Patil , SITCOE Yadrav 6 StudentID FirstName LastName Age 1 Atul Mishra 23 2 Priya Kapoor 21 3 Rohan Singhania 21 4 Akanksha Jain 20 5 Vaibhav Gupta 25 StudentID FirstName LastName Age 1 Atul Mishra 23
  • 7. Pattern Matching Operator- Like This operator is used along with the WHERE clause to retrieve the data according to a specific pattern. There are two wildcards which are used along with the LIKE operator to retrieve data. They are: • %[Percentage Sign] – It matches 0 or more character. • _ [Underscore]– It matches exactly one character. Syntax: SELECT column1, coulmn2, . . ., columnN FROM tablename WHERE columnName LIKE pattern; Mrs U. S. Patil , SITCOE Yadrav 7
  • 8. Consider the following table on which we will apply various operations of the LIKE operator. Example: Select all students starting with “a” SELECT * FROM students WHERE studentname LIKE 'a%'; Output: Mrs U. S. Patil , SITCOE Yadrav 8 studentID studentname 1 akash 2 mitali 3 sanjay 4 anuj 5 sonali studentID studentname 1 akash 4 anuj
  • 9. Mrs U. S. Patil , SITCOE Yadrav 9 Example 2: Select all students with a studentname ending with “i” SELECT * FROM students WHERE studentname LIKE '%i'; Output: Example 3: Select all students with a studentname that have “o” in the second position: SELECT * FROM students WHERE studentname LIKE '_o%'; Output: studentID studentname 2 mitali 5 sonali studentID studentname 5 sonali
  • 10. Example 4: Select all students with a studentname that start with “a” and are at least 5 characters in length SELECT * FROM students WHERE studentname LIKE 'a____%'; Output: Example 5: Select all students with a studentname that start with “s” and end with “y” SELECT * FROM students WHERE studentname LIKE 's%y'; Output: Mrs U. S. Patil , SITCOE Yadrav 10 studentID studentname 1 akash studentID studentname 3 sanjay
  • 11. Mrs U. S. Patil , SITCOE Yadrav 11