Now add some employee data to the table using the below command:INSERT INTO employee (
employee_id,
first_name,
last_name,
manager_id
)
VALUES
(1, 'Sandeep', 'Jain', NULL),
(2, 'Abhishek ', 'Kelenia', 1),
(3, 'Harsh', 'Aggarwal', 1),
(4, 'Raju', 'Kumar', 2),
(5, 'Nikhil', 'Aggarwal', 2),
(6, 'Anshul', 'Aggarwal', 2),
(7, 'Virat', 'Kohli', 3),
(8, 'Rohit', 'Sharma', 3);
The value in the manager_id column represents the senior manager who the employee reports to. If it’s Null, he/she doesn’t report to anyone.
The overall hierarchy looks like the below image:

Our current tables looks like below:

Now let’s update data in the above mentioned table.
Example 1:
Here we will update the employee “Raju Kumar” name to “Raju Singh” using the UPDATE statement.
UPDATE employee
SET last_name = 'Singh'
WHERE first_name = 'Raju';
Output:

Example 2:
In the above we made an update to a single row, but here we will make changes to multiple rows. Here we will change the last name of everyone to ‘Gupta’ whose last name is ‘Aggarwal’.
UPDATE employee
SET last_name = 'Gupta'
WHERE last_name = 'Aggarwal';
Output:
