Skip to content

Commit 7873f03

Browse files
authored
Merge branch 'main' into patch-3
2 parents 3ad2cd8 + f4fa18b commit 7873f03

9 files changed

+806
-166
lines changed

blog/Introduction to Cyber Security and Web Explosion.md

Lines changed: 179 additions & 0 deletions
Large diffs are not rendered by default.

blog/authors.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,3 +46,9 @@ nayanikamukherjee:
4646
title: Full Stack Developer
4747
url: "https://github.com/Nayanika1402"
4848
image_url: https://avatars.githubusercontent.com/u/132455412?v=4
49+
50+
pujan-sarkar:
51+
name: Pujan Sarkar
52+
title: Cyber Security Enthusiast
53+
url: "https://github.com/Pujan-sarkar"
54+
image_url: https://avatars.githubusercontent.com/u/144250917?v=4

docs/SQL/SQL-OR-Operator.md

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
---
2+
id: sql-or-operator
3+
title: OR Operator in SQL
4+
sidebar_label: OR Operator
5+
sidebar_position: 5
6+
tags: [sql, database, operator ]
7+
description: In this tutorial, you will learn how to add OR operator in the query to get desired output.
8+
---
9+
10+
The OR operator in SQL is used to combine multiple conditions in a WHERE clause, returning rows that satisfy at least one of the conditions specified.
11+
12+
# Syntax
13+
`SELECT column1, column2, ... FROM table_name WHERE condition1 OR condition2 OR condition3 ...;`
14+
15+
# Advantage of SQL WHERE Clause
16+
17+
**1.Order of Evaluation:**
18+
SQL evaluates conditions combined with AND before those combined with OR. Use parentheses to explicitly define the order of evaluation.
19+
20+
**2.Performance:**
21+
The performance of queries using OR can be influenced by the presence of indexes on the columns involved in the conditions. Proper indexing can significantly speed up query execution.
22+
23+
# Example of Order By Clause in SQL
24+
25+
**1.Selecting rows based on multiple conditions:**
26+
- Example : `SELECT * FROM Employees WHERE Age < 25 OR Department = 'HR';`
27+
- Description : Suppose you have a table called Employees with columns EmployeeID, FirstName, LastName, Age, and Department.This query selects all employees who are either younger than 25 or work in the HR department.
28+
29+
**2.Using OR with other operators:**
30+
- Example : `SELECT * FROM Employees WHERE Age < 25 OR Age > 50 OR Department = 'Sales';`
31+
- Description : You can combine OR with other comparison operators like `=`, `!=`, `<`, `>`, `<=`, `>=`.This query selects all employees who are either younger than 25, older than 50, or work in the Sales department.
32+
33+
**3.Combining OR with AND:**
34+
- Example : `SELECT * FROM Employees WHERE (Age < 25 AND Department = 'Marketing') OR (Age > 50 AND Department = 'Sales');`
35+
- Descriptiom : When combining OR with AND, you often use parentheses to ensure the correct order of evaluation.This query selects employees who are either younger than 25 and work in Marketing or older than 50 and work in Sales.
36+
37+
# Conclusion
38+
The OR operator in SQL is essential for retrieving rows that meet at least one of several conditions within a WHERE clause. Understanding and effectively using the OR operator enhances your ability to filter data according to complex criteria. Proper use of parentheses ensures the correct logical evaluation, and indexing relevant columns can improve query performance. For further insights, refer to the documentation specific to your SQL database system.
39+
40+
41+
## Authors:
42+
43+
<div style={{display: 'flex', flexWrap: 'wrap', justifyContent: 'space-between', gap: '10px'}}>
44+
{['damini-chachane'].map(username => (
45+
<Author key={username} username={username} />
46+
))}
47+
</div>

docs/SQL/SQL-ORDER-BY-Clause.md

Lines changed: 0 additions & 83 deletions
This file was deleted.

docs/SQL/SQL-Order-By-Clause.md

Lines changed: 0 additions & 83 deletions
This file was deleted.

0 commit comments

Comments
 (0)