Using UPDATE
Once our data is in a table, we're not done with it. Addresses, names, and many other types of data will change, and when data in a table needs to be updated, we use the UPDATE
command. The basic syntax is as follows:
UPDATE <table_name> SET column_name1={expression|DEFAULT} [, column_name2={expression|DEFAULT}] … [WHERE <where_conditions>];
Unlike the INSERT
command, when we are updating data, we specify the data we want to insert right after each column name.
Another difference is the inclusion of a WHERE
section. The WHERE
section is very important because we use it to specify the exact column or columns of data in the table that we want to change. If we omit the WHERE
section, the UPDATE
statements will update every instance ...
Get Getting Started with MariaDB - Second Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.