Commit c9f0262
committed
docs(sql): add dedicated folder for WHERE clause with detailed explanation
What
- Created `WHERE Clause In SQL` folder to document filtering records in SQL queries.
- Explained how `WHERE` is used to apply conditions before grouping or sorting.
- Added syntax, examples, and operator usage (comparison, logical, pattern matching).
- Clarified how `WHERE` differs from `HAVING`.
Why
- Filtering data is the foundation of SQL querying.
- Developers often confuse `WHERE` with `HAVING` or misuse operators (`=`, `LIKE`, `IN`, `BETWEEN`).
- Clear reference improves query accuracy and performance.
How
- Structured documentation into:
- Definition and purpose of `WHERE`.
- Basic syntax:
`SELECT * FROM employees WHERE dept = 'HR';`
- Comparison operators (`=`, `!=`, `<`, `>`, `<=`, `>=`).
- Logical operators (`AND`, `OR`, `NOT`).
- Special operators (`BETWEEN`, `IN`, `LIKE`, `IS NULL`).
- Showed ordering of execution: `FROM → WHERE → GROUP BY → HAVING → ORDER BY`.
Key notes
- `WHERE` filters rows before grouping or aggregation.
- Case sensitivity may vary depending on SQL dialect and collation.
- Always use parameterized queries in applications to prevent SQL injection.
Real-life applications
- Banking: filter accounts with balance > 1,00,000.
- HR: find employees hired after 2020.
- Retail: fetch products priced between 100 and 500.
- Education: list students who scored above 80 in Math.
Future improvements
- Add combined examples using multiple operators.
- Include advanced filtering with subqueries inside `WHERE`.
- Compare performance implications of indexed vs non-indexed columns.
Signed-off-by: https://github.com/Someshdiwan <[email protected]>1 parent 8e76f8c commit c9f0262
File tree
13 files changed
+1
-2
lines changed- Section28JDBCusingSQLite/Clauses in SQL/WHERE Clause In SQL
13 files changed
+1
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
7 | | - | |
8 | 7 | | |
9 | 8 | | |
10 | 9 | | |
| |||
33 | 32 | | |
34 | 33 | | |
35 | 34 | | |
36 | | - | |
| 35 | + | |
0 commit comments