0% found this document useful (0 votes)
15 views8 pages

PCS 203-SM02

Uploaded by

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

PCS 203-SM02

Uploaded by

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

Practical No.

2
Write SQL queries using logical operators [ =, <,>, etc]

Given below is the list of logical operators available in SQL.


Operator Meaning

AND TRUE if both Boolean expressions are TRUE.

IN TRUE if the operand is equal to one of a list of expressions.

NOT Reverses the value of any other Boolean operator.

OR TRUE if either Boolean expression is TRUE.

LIKE TRUE if the operand matches a pattern.

BETWEEN TRUE if the operand is within a range.

ALL TRUE if all of a set of comparisons are TRUE.

ANY TRUE if any one of a set of comparisons is TRUE.

EXISTS TRUE if a subquery contains any rows.

SOME TRUE if some of a set of comparisons are TRUE.

1) AND Operator
The AND operator is used to combines two or more conditions but if it is true when all the conditions
are satisfied.
2) IN Operator
It is used to remove the multiple OR conditions in SELECT, INSERT, UPDATE, or DELETE. and We can also
use NOT IN to minimize the rows in your list and any kind of duplicate entry will be retained.
3) NOT Operator
The NOT operator is used in combination with other operators to give the opposite result, also called
the negative result.

4) OR Operator
The OR operator is used to combines two or more conditions but if it is true when one of the conditions
are satisfied.
5) LIKE Operator
In SQL, the LIKE operator is used in the WHERE clause to search for a specified pattern in a column.

% – It is used for zero or more than one character.

6) BETWEEN Operator
The SQL BETWEEN condition allows you to easily test if an expression is within a range of values
(inclusive).
7) ALL Operator
The ALL operator returns TRUE if all of the subqueries values matches the condition. All operator is used
with SELECT, WHERE, HAVING statement.

8) ANY Operator
It returns a boolean value as a result. It returns TRUE if ANY of the subquery values match the condition.
9) EXISTS Operator
In SQL,Exists operator is used to check whether the result of a correlated nested query is empty or not.

Exists operator is used with SELECT, UPDATE, INSERT or DELETE statement.

The EXISTS operator is used to test for the existence of any record in a subquery. The EXISTS operator
returns TRUE if the subquery returns one or more records.

10) SOME Operator


In SQL, SOME operators are issued with comparison operators (<,>,=,<=, etc) to compare the value with
the result of a subquery.

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy