0% found this document useful (0 votes)
6 views2 pages

Basic SQL Operators

Sql

Uploaded by

pspandhare
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)
6 views2 pages

Basic SQL Operators

Sql

Uploaded by

pspandhare
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

Basic Operators in SQL

Arithmetic Operators
Operator Description Example

+ Addition SELECT 10 + 5 AS Sum;

- Subtraction SELECT 10 - 5 AS
Difference;

* Multiplication SELECT 10 * 5 AS Product;

/ Division SELECT 10 / 5 AS Quotient;

% Modulus (remainder) SELECT 10 % 3 AS


Remainder;

Comparison Operators
Operator Description Example

= Equal SELECT * FROM students


WHERE marks = 50;

!= or <> Not equal SELECT * FROM students


WHERE marks != 50;

> Greater than SELECT * FROM students


WHERE marks > 50;

< Less than SELECT * FROM students


WHERE marks < 50;

>= Greater than or equal SELECT * FROM students


WHERE marks >= 50;

<= Less than or equal SELECT * FROM students


WHERE marks <= 50;

Logical Operators
Operator Description Example

AND True if all conditions are SELECT * FROM employees


true WHERE department='IT'
AND salary>30000;

OR True if any condition is true SELECT * FROM employees


WHERE department='IT' OR
department='HR';

NOT Negates the condition SELECT * FROM employees


WHERE NOT
department='HR';

Special Operators
Operator Description Example

BETWEEN Check if value is within a SELECT * FROM products


range WHERE price BETWEEN
100 AND 500;

IN Check if value is in a list SELECT * FROM employees


WHERE department IN
('IT','Finance');

LIKE Pattern matching with % SELECT * FROM customer


and _ WHERE name LIKE 'A%';

IS NULL Check for NULL values SELECT * FROM orders


WHERE delivery_date IS
NULL;

You might also like