0% found this document useful (0 votes)
5 views

SQL Operators-Copy

The document provides an overview of SQL operators, including logical operators like AND, OR, and BETWEEN, which are used to filter and manipulate data in SQL queries. It also discusses the LIKE operator for pattern matching and the NOT and IN operators for excluding or specifying multiple values. Additionally, it includes promotional discounts for various coding platforms and resources for coding projects.

Uploaded by

Sunil
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views

SQL Operators-Copy

The document provides an overview of SQL operators, including logical operators like AND, OR, and BETWEEN, which are used to filter and manipulate data in SQL queries. It also discusses the LIKE operator for pattern matching and the NOT and IN operators for excluding or specifying multiple values. Additionally, it includes promotional discounts for various coding platforms and resources for coding projects.

Uploaded by

Sunil
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 12

By @Curious_.

programmer

Curious_.Programmer
SQL OPERATORS
SQL operators are used to perform operations on data
in SQL queries.

They help in filtering, comparing, and manipulating


data in a database.

Common types include Arithmetic, Comparison, and


Logical operators for efficient data handling.

Copyright: IG: Curious_.programmer


CodeWithCurious.com

STUDENT INFORMATION TABLE

Curious_.Programmer
Get Discount on Top Tech
Platform Name Deal Details Deal Link

35% discount on courses, Coupon Show


Geeksforgeeks
Code: SAVEGFG Coupon

Show
Coding Ninjas 10% discount, Coupon Code: KHUAG
Coupon

Show
KodeKloud 60% discount, Coupon Code: CWC10
Coupon

Flat 50% discount, Coupon Code: Show


SkillShare
CWC Coupon

Flat 50% discount, Coupon Code: Show


Educative
SAVEIT20 Coupon

20% discount, Coupon Code: Show


w3schools
CURIOUS_PROGRAMMER Coupon

Flat 30% discount, Coupon Code: Show


EDX
CURIOUS15 Coupon

Flat 50% discount, Coupon Code: Show


DataCamp
DEC24-INDIA Coupon

Target Test Show


30% off, Coupon Code: CODE10
Prep Coupon

Curious_.Programmer
LOGICAL OPERATOR

The SQL AND operator is used with the where clause in the
SQL Query. AND operator in SQL returns only those records
which satisfy both the conditions in the SQL query.
Copyright: IG: Curious_.programmer
CodeWithCurious.com
QUERY>
SELECT *FROM Student WHERE NAME="Yadnyesh" AND City="Pune";

Output>

In above example the sql statement returns only one


value cause in Given table and their is only one student
who has name "yadnyesh" & he belongs to Mumbai.

Note : TRUE if all the conditions separated by AND is


TRUE

Curious_.Programmer
The BETWEEN operator in SQL shows the record within
the range mentioned in the SQL query. This operator
operates on the numbers, characters, and date/time
operands.
If there is no value in the given range, then this operator
shows NULL value.Copyright: IG: Curious_.programmer
CodeWithCurious.com
QUARY>
SELECT *FROM Student WHERE DIVISION="C" OR City="Delhi";
Output>

In the above example the sql statement returns three


values. cause Given table have two Students who belongs
to C Division & one is from delhi.

Note: TRUE if any of the conditions separated by OR is TRUE

Curious_.Programmer
500+ Coding Projects
With Source Code Free
Download
Click Here for 500+ Projects Code

Curious_.Programmer
The BETWEEN operator in SQL shows the record within
the range mentioned in the SQL query. This operator
operates on the numbers, characters, and date/time
operands.

QUERY>
SELECT * FROM Student WHERE Roll_No BETWEEN 102 AND 104;
Copyright: IG: Curious_.programmer
Output> CodeWithCurious.com

In the above example the sql statement returns three


values. cause in Roll_NO column there is only 3 Values
Lies From 102 to 104.

Note: BETWEEN returns all the values from given start record to
end records

Curious_.Programmer
It filters the records from the columns based on the
pattern specified in the SQL query. LIKE is used in the
WHERE clause with the following three statements:
1. SELECT Statement
Copyright: IG: Curious_.programmer
2. UPDATE Statement CodeWithCurious.com
3. DELETE Statement
There are two wildcards often used in conjunction with the
LIKE operator:
The percent sign (%) represents zero, one, or multiple
characters
The underscore sign (_) represents one, single
character

QUERY:
SELECT * FROM Student WHERE NAME LIKE 'Y%';

output:

Curious_.Programmer
QUERY:
SELECT * FROM Student WHERE CITY LIKE '_u%';
Copyright: IG: Curious_.programmer
output: CodeWithCurious.com

In first Query returns all Name of students starting from


Y. In second Example returns all the records who have
second Latter is U then any combination of latter.

Curious_.Programmer
NOT operator in SQL shows those records from the table
where the criteria is not met. NOT operator is used with
where clause in a SELECT query.
Copyright: IG: Curious_.programmer
Query: CodeWithCurious.com
SELECT * FROM Students WHERE NOT City = "Mumbai";

Output:

in the above example returns those student records


those who are not from mumbai. this query shows
records of students having City other than mumbai.

Curious_.Programmer
When we want to check for one or more than one value in
a single SQL query, we use IN operator with the WHERE
clause in a SELECT query.

Query:
SELECT * FROM Students WHERE City IN("Delhi","Pune");
Copyright: IG: Curious_.programmer
Output: CodeWithCurious.com

in the above example returns those student records


those who are from Delhi and Pune. other student will not
displayed.

Curious_.Programmer
👆
Free Ebooks, Handwritten Notes Avaliable

Curious_.Programmer

You might also like