SQL WHERE Clause in DML Statements
The WHERE clause in SQL is an essential part of Data Manipulation Language (DML) statements. While not mandatory, it plays a crucial role in filtering records and refining query results. It restricts the rows affected by SELECT, UPDATE, and DELETE statements so only the required data is processed.
Complete Python Course with Advance topics:-
SQL Tutorial:-
Syntax of the WHERE Clause
SELECT column1, column2, ...
FROM table_name
WHERE [condition];
The WHERE clause is placed immediately after FROM and before ORDER BY or GROUP BY.
Conditional Operators
=Equal to>Greater than,<Less than>=/<=Greater/Less than or equal<>Not equal toBETWEEN,LIKE,INÔÇö range, pattern, and list matchingAND,OR,NOTÔÇö combine conditions
Example 1: WHERE in SELECT
SELECT emp_name, department, salary
FROM employees
WHERE salary > 60000;
Example 2: WHERE in UPDATE
UPDATE employees
SET salary = salary + 5000
WHERE department = 'IT';
Example 3: WHERE in DELETE
DELETE FROM employees
WHERE department = 'HR';
Combining Conditions Example
SELECT * FROM employees
WHERE department = 'IT' AND salary BETWEEN 50000 AND 80000;
Download New Real Time Projects:- Click here
Complete Advance AI topics:-
Conclusion
The WHERE clause refines queries to make them efficient and precise. By applying conditions and combining operators, you control which rows are affected by SELECT, UPDATE, and DELETE. Mastering it is essential for effective database management. For more SQL tutorials, stay connected with .
sql where multiple conditions
sql where clause multiple values
having clause in sql
where clause in sql example
sql where between
sql where like
sql where in
sql where clause w3schools