Modifying Data
Learn how to use the UPDATE statement to modify the data in the database.
We'll cover the following...
Sometimes, data is inserted erroneously in the database. This can involve two types of mistakes: inserting a wrong value against a certain field or mistakenly inserting an entire record. Alongside rectifying such inconsistencies, we also need ongoing management and synchronization of data, such as ensuring that a person’s address remains current and accurate. Situations like these require making alterations to the data. For this purpose, we employ the UPDATE
and DELETE FROM
statements in SQL as and when needed. These are explained below:
The UPDATE
statement
Consider a scenario where an error exists in one of the records, necessitating correction. For example, let’s consider a sale with SaleID
3
, where the current sales ...