"if you encounter any errors in SAP, send me a screenshot at pramod@learntosap.com, and I will help you resolve the issue."

SQL UPDATE Statement – Syntax, Examples, and Best Practices

SQL TUTORIALS-

SQL UPDATE Statement

Introduction-


Trulli Trulli

What is the SQL UPDATE Statement? AND How to Use SQL UPDATE Statement with Examples (Beginner’s Guide)

-πŸ” SQL UPDATE statement is used to modify existing records in a table.

βœ… 1-Basic syntax is Follow:-


UPDATE table_name
SET column1 = value1, column2 = value2, ...
WHERE condition;


Emoji Examples in HTML

πŸ”Έ Example Table: Employees

ID Name Department Salary
1 ANNI IT 10000
2 POOJA IT 9000
3 RAJ HR 5000

βœ… Example 2: Update a single row:-


UPDATE Employees
SET Salary = 62000
WHERE ID = 2;


Row inserted β†’ 2 | POOJA | IT | 62000

βœ…Result Show :-

Emoji Examples in HTML

πŸ”Έ Example Table: Employees


ID Name Department Salary
1 ANNI IT 10000
2 POOJA IT 62000
3 RAJ HR 5000

βœ… Example 2: Update multiple rows with a condition:-

βœ…UPDATE Query :-


UPDATE Employees
SET Salary = Salary + 2000
WHERE Department = 'HR';

Row inserted β†’ Salary | HR | 2000

βœ…Result Show :-

Emoji Examples in HTML

πŸ”Έ Example Table: Employees

ID Name Department Salary
1 ANNI IT 10000
2 POOJA IT 9000
3 RAJ HR 7000

Example 3: Update based on another column value:-

βœ…UPDATE Query :-


UPDATE Employees
SET Department = 'IT'
WHERE Salary > 8000;

Row inserted β†’ | ANNI | IT | 8000

Row inserted β†’ | POOJA | IT | 62000

βœ…Result Show :-

Emoji Examples in HTML

πŸ”Έ Example Table: Employees

ID Name Department Salary
1 ANNI IT 8000
2 POOJA IT 62000
3 RAJ HR 7000

May Be Like Important Link-

-Chart Of Account-OB13

-Define Plant-OX1

-Chart Of Account-OB13

-Define Financial Statement