sql / beginner
Snippet
Updating Existing Data
The UPDATE statement is used to modify the existing records in a table. It is crucial to use a WHERE clause to specify which record(s) should be updated; otherwise, all records in the table will be changed.
snippet.sql
1
2
3
UPDATE employeesSET salary = 5500WHERE employee_id = 101;
Breakdown
1
UPDATE employees
Specifies the table that contains the data to be modified.
2
SET salary = 5500
Defines the column to change and the new value to be assigned.
3
WHERE employee_id = 101
Ensures only the specific employee with ID 101 is affected.