dev-resources.site
for different kinds of informations.
SQL Operators Made Easy for Beginners
Published at
7/9/2024
Categories
operators
beginners
server
Author
shikha_gupta_080e904b317e
Author
25 person written this
shikha_gupta_080e904b317e
open
SQL Operators Made Easy for Beginners
SQL (Structured Query Language) uses operators to perform operations on data. Hereโs a simple guide to understand the basics:
- Arithmetic Operators These are used for mathematical operations.
-
+
(Addition): Adds two numbers.
SELECT 3 + 2; -- Result is 5
-
-
(Subtraction): Subtracts one number from another.
SELECT 5 - 3; -- Result is 2
-
(Multiplication): Multiplies two numbers.
sql SELECT 4 2; -- Result is 8
`` -
/
(Division): Divides one number by another.`sql SELECT 10 / 2; -- Result is 5 `
-
%
(Modulus): Returns the remainder of a division.`sql SELECT 10 % 3; -- Result is 1 `
- Comparison Operators These are used to compare two values.
-
=
(Equal): Checks if two values are equal.`sql SELECT FROM employees WHERE salary = 50000; `
-
!=
or<>
(Not Equal): Checks if two values are not equal.`sql SELECT FROM employees WHERE department != 'HR'; `
-
>
(Greater Than): Checks if the left value is greater than the right value.`sql SELECT FROM employees WHERE age > 30; `
-
<
(Less Than): Checks if the left value is less than the right value.`sql SELECT FROM employees WHERE age < 25; `
-
>=
(Greater Than or Equal To): Checks if the left value is greater than or equal to the right value.`sql SELECT FROM employees WHERE experience >= 5; `
-
<=
(Less Than or Equal To): Checks if the left value is less than or equal to the right value.`sql SELECT FROM employees WHERE experience <= 2; `
- Logical Operators These are used to combine multiple conditions.
-
AND
: Combines two or more conditions. All conditions must be true.`sql SELECT FROM employees WHERE age > 25 AND department = 'Finance'; `
-
OR
: Combines two or more conditions. At least one condition must be true.`sql SELECT FROM employees WHERE age < 30 OR department = 'HR'; `
-
NOT
: Reverses the result of a condition.`sql SELECT FROM employees WHERE NOT (age < 30); `
- Between and In Operators
-
BETWEEN
: Selects values within a given range (inclusive).`sql SELECT FROM employees WHERE salary BETWEEN 30000 AND 50000; `
-
IN
: Checks if a value is within a set of values.`sql SELECT FROM employees WHERE department IN ('HR', 'Finance', 'IT'); `
- LIKE and IS NULL Operators
-
LIKE
: Used for pattern matching.%
represents zero or more characters,_
represents a single character. `sql SELECT FROM employees WHERE name LIKE 'J%'; -- Names starting with 'J' SELECT FROM employees WHERE name LIKE '_
operators Article's
30 articles in total
Essential MySQL Operators and Their Applications
read article
Exposing replica nodes in Percona Operator for PostgreSQL
read article
Itโs just โ,โ โ The Comma Operator
read article
Operators, Conditionals and Inputs
read article
Practical Guide to Python Conditional Statements
read article
Python Operators Demystified
read article
SQL Operators Made Easy for Beginners
currently reading
First Steps in SQL Operators: A Beginner's Guide
read article
AND / OR operators, Short-Circuiting and Nullish Coalescing in Javascript
read article
From Zero to Hero: Disaster Recovery for PostgreSQL with Streaming Replication in Kubernetes
read article
Google Search Operators & Usage Tips
read article
Operators in C programming
read article
MySQL Operators โ A Guide
read article
Annotations in Kubernetes Operator Design
read article
Exploring the unusual: JavaScript arrays and the 'in' operator
read article
Install Kubernetes Controllers via Operators - ARGO CD
read article
Mastering Advanced JavaScript Operators: The Ultimate Guide
read article
Operators in JavaScript: The Fundamentals
read article
Dart as, is, is! operatรถrleri
read article
Nullish Coalescing Operator
read article
Difference between ? and ?? in JavaScript/Typescript
read article
Ordering Event Bus Events with RxJS and concatMap
read article
Division, Floor Division and Modulus - Python Arithmetic Operators every beginner should know.
read article
Operators in Python
read article
Angular - Rxjs - Operator mergeAll
read article
Angular - Rxjs - Operator map
read article
Swift โ 11 Useful Combine Operators You Need to Know
read article
Cloud Native CICD Pipelines in OpenShift
read article
Kubernetes Operators to realize the dream of Zero-Touch Ops
read article
JavaScript Basic - Variable, Data Types, Operators, Comparisons
read article
Featured ones: