set Home >Database >Mysql Tutorial >How to write sql update statement The update statement in the SQL database must be completed using the UPDATE statement. The function of the UPDATE statement is to change the existing data in the database to achieve the purpose of updating the data. Its syntax is "update 2d8f501bba7dbcabf64f6c8aceccc3b7 set f4c55dd52f1b37a9debd48ac1ff8dbb5 = 8487820b627113dd990f63dd2ef215f3 where...". UPDATE syntax Syntax introduction Example: The above is the detailed content of How to write sql update statement. For more information, please follow other related articles on the PHP Chinese website!How to write sql update statement
##The update statement in the SQL database must be completed using the UPDATE statement. The function of the UPDATE statement is to change the existing data in the database to achieve the purpose of updating the data. In real applications, data changes in the database are inevitable. Typically, most of the data in almost all user databases will be modified to some degree. If you want to modify database records in a SQL Server database, you need to use the UPDATE statement. The UPDATE statement exists to change the existing data in the database. This statement, although it has some complex options, is one of the easiest to learn. This is because in most cases, the high-level part of this statement is rarely used. From the user's perspective, the UPDATE statement is only used to change the data in the specified row. But what actually happens internally is that SQL Server deletes old data rows from the table and inserts new rows.
update <table_name> set <column_name> = <value> where <search_condition>
update users set phone=78789831 where number =231;
For example, now we want to increase the price of each item in the supermarket table by 11%. Is it necessary to write an independent UPDATE statement for each row? ? In the current situation, there may not be many UPDATE statements to write, but if it is a larger table, this will be a problem. So the answer is no. All you have to do is write an UPDATE statement that does not specify the rows to be updated, like this: The code is as follows:update shop set priceprice = price * .11 ;