Introduction

In this article, we will learn how to write a SQL update query with Where condition.

To modify the existing data in the SQL UPDATE statement is used.

To filter records and extract only those records that fulfill a specified condition, The WHERE clause is used.

Syntax

UPDATE TABLE_NAME
SET column1 = value1, column2 = value2, ...columnN = ...valueN
WHERE condition;

Example

The subsequent statement would update only those records that fulfill a specified condition in the Article table.

UPDATE Article
SET Id = 'A0', Title = 'Introduction'
WHERE Id = 'A1';

 

Also, check How To Write Update Query In SQL