Files
doris/docs/en/sql-manual/sql-reference/Data-Manipulation-Statements/Manipulation/UPDATE.md
Mingyu Chen 74a482ca7f [fix] fix docs build bug (#9293)
After this PR #9272, the `docs/build_help_zip.sh` will run failed.
This PR fix this issue.
But the help module still has some parse problem, I will fix it in next PR.

This CL mainly changes:
1. fix `docs/build_help_zip.sh` error
2. remove `sql-reference-v2` to `sql-reference`
3. modify build extension github action to run `docs/build_help_zip.sh`
2022-04-28 22:19:04 +08:00

2.2 KiB

title, language
title language
UPDATE en

UPDATE

Name

UPDATE

Description

This statement is used to update the data (the update statement currently only supports the Unique Key model).

UPDATE table_name
    SET assignment_list
    WHERE expression

value:
    {expr | DEFAULT}

assignment:
    col_name = value

assignment_list:
    assignment [, assignment] ...

Parameters

  • table_name: The target table of the data to be updated. Can be of the form 'db_name.table_name'
  • assignment_list: The target column to be updated, in the format 'col_name = value, col_name = value'
  • where expression: the condition that is expected to be updated, an expression that returns true or false can be

Note

The current UPDATE statement only supports row updates on the Unique model, and there may be data conflicts caused by concurrent updates. At present, Doris does not deal with such problems, and users need to avoid such problems from the business side.

Example

The test table is a unique model table, which contains four columns: k1, k2, v1, v2. Where k1, k2 are keys, v1, v2 are values, and the aggregation method is Replace.

  1. Update the v1 column in the 'test' table that satisfies the conditions k1 =1 , k2 =2 to 1
UPDATE test SET v1 = 1 WHERE k1=1 and k2=2;
  1. Increment the v1 column of the k1=1 column in the 'test' table by 1
UPDATE test SET v1 = v1+1 WHERE k1=1;

Keywords

UPDATE

Best Practice