0% found this document useful (0 votes)
4 views28 pages

WEEK

The document outlines various SQL operators used in querying databases, categorized into special, comparison, logical, arithmetic, string, and bitwise operators. Each category includes examples of syntax for using these operators with a 'Student5' table. Key operators such as BETWEEN, IN, LIKE, AND, OR, and arithmetic operations are detailed for practical application in SQL queries.

Uploaded by

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

WEEK

The document outlines various SQL operators used in querying databases, categorized into special, comparison, logical, arithmetic, string, and bitwise operators. Each category includes examples of syntax for using these operators with a 'Student5' table. Key operators such as BETWEEN, IN, LIKE, AND, OR, and arithmetic operations are detailed for practical application in SQL queries.

Uploaded by

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

1.

Special Operators:
BETWEEN:
Syntax: SELECT * FROM Student5 WHERE Age BETWEEN 32 AND 34;
IN:
Syntax: SELECT * FROM Student5 WHERE StudentName IN('Shaurya','Namratha');
LIKE:
Syntax: SELECT *FROM Student5 WHERE StudentName LIKE 'S%';
IS NULL:
Syntax: SELECT * FROM Student5 WHERE Age IS NULL;
2.Comparison Operators:
Equal to:
Syntax: SELECT * FROM Student5 WHERE Age = 30;
Not equal to:
Syntax: SELECT * FROM Student5 WHERE Age <> 30;
Greater than:
Syntax: SELECT * FROM Student5 WHERE Age>30;
Less than:
Syntax: SELECT * FROM Student5 WHERE Age<34;
Greater than or equal to:
Syntax: SELECT * FROM Student5 WHERE Age>=30;
Less than or equal to:
Syntax: SELECT * FROM Student5 WHERE Age<=34;
3.Logical Operators:
AND: Returns true if both conditions are true.
Syntax: SELECT * FROM Student5 WHERE Age>28 AND StudentName='Sekharbabu';
OR: Returns true if at least one condition is true.
Syntax: SELECT * FROM Student5 WHERE Age>35 OR StudentName='Sekharbabu';
NOT: Reverses the condition.
Syntax: SELECT * FROM Student5 WHERE NOT StudentName='Dora';
4.Arithmetic Operators:
i.Addition(+):
->adding some value to column.
Syntax: SELECT Age+10 FROM Student5;
->adding two columns.
Syntax: SELECT Age + StudentID FROM Student5;
Syntax: SELECT StudentID, StudentName, Email, Age + StudentID ,DeptID FROM Student5;
Syntax: SELECT StudentID, StudentName, Email, DeptID,Age + 10 AS "Age" FROM Student5;
ii.Subtraction (-):
->Subtracting some value from column.
Syntax: SELECT Age-10 FROM Student5;
->subtracting two colums.
Syntax: SELECT Age - StudentID FROM Student5;
iii.Multiplication (*):
->Multiplying some value to column.
Syntax: SELECT Age*10 FROM Student5;
Syntax: SELECT Age * StudentID FROM Student5;
iv. Division (/):
->dividing some value with column.
Syntax: SELECT Age/10 FROM Student5;
->Dividing two columns.
Syntax: SELECT Age / StudentID FROM Student5;\
v.Modulus ( % ):
Syntax: SELECT MOD(Age,10) FROM Student5;
Syntax: SELECT MOD(Age , StudentID) FROM Student5;
5.String Operators:
CONCAT():
Syntax: SELECT StudentName || StudentID FROM Student5;
Syntax: SELECT CONCAT(StudentName,StudentID) FROM Student5;
6.Bitwise Operators:
Bitwise AND:
Syntax: SELECT BITAND(Age,10) FROM Student5;

You might also like