Home Python C Language C ++ HTML 5 CSS Javascript Java Kotlin SQL DJango Bootstrap React.js R C# PHP ASP.Net Numpy Dart Pandas Digital Marketing

WHERE Clause



The SQL WHERE Clause


In SQL, the WHERE clause is used to filter rows returned by a SELECT, UPDATE, or DELETE statement based on specified conditions. It allows you to specify criteria that must be met for a row to be included in the result set or affected by the operation.

Here's the basic syntax of the WHERE clause in a SELECT statement:


SELECT column1, column2, ...
FROM table_name
WHERE condition;


Explanation of each part:

Example:

Suppose we have a table called employees with columns employee_id, first_name, last_name, and department. We want to retrieve the names of employees who work in the Sales department:


SELECT first_name, last_name
FROM employees
WHERE department = 'Sales';


In this example:

You can also use the WHERE clause in UPDATE and DELETE statements to specify which rows should be updated or deleted based on certain conditions.



Advertisement





Q3 Schools : India


Online Complier

HTML 5

Python

java

C++

C

JavaScript

Website Development

HTML

CSS

JavaScript

Python

SQL

Campus Learning

C

C#

java