Updating data, UPDATE operator

To edit existing records in tables, there is an SQL operator UPDATE.

General query structure with the UPDATE operator

MySQL
UPDATE table_name
SET table_field1 = table_field_value1,
    table_fieldN = table_field_valueN
[WHERE the_conditions_of_the_limitations]

So, for example, if you need to change the name, the request will look like this:

MySQL
UPDATE FamilyMembers
SET member_name = "Andie Anthony"
WHERE member_name = "Andie Quincey";
member_idstatusmember_namebirthday
1fatherHeadley Quincey1960-05-13T00:00:00.000Z
2motherFlavia Quincey1963-02-16T00:00:00.000Z
3varchar(50)Andie Anthony1983-06-05T00:00:00.000Z
4daughterLela Quincey1985-06-07T00:00:00.000Z
5daughterAnnie Quincey1988-04-10T00:00:00.000Z
6fatherErnest Forrest1961-09-11T00:00:00.000Z
7motherConstance Forrest1968-09-06T00:00:00.000Z
8daughterWednesday Addams2005-01-13T00:00:00.000Z

Be careful when updating data. If you skip the WHERE operator, all entries will be updated.

Calculated Values

In data update requests, you can change values based on previous values.

MySQL
UPDATE Payments
SET unit_price = unit_price * 2;

It is also allowed to assign values of some columns to other columns. But at the same time, of course, column types must be compatible.