SQLupdate语句怎么写

update功能

在SQL中,update语句的功能是更新表中已有数据记录的内容。

update语法结构

1、单表更新

单表更新一个字段:

UPDATE table_name

SET column_name = value

WHERE condition

单表同时更新多个字段:

UPDATE table_name

SET column1 = value1, column2 = value2

WHERE condition1

AND condition2

2、多表关联更新

2.1 PgSQL数据库语法结构:

UPDATE table_name1

SET column1 = value1, column2 = value2

FROM table_name2

WHERE condition1

AND condition2

2.2 MySQL数据库语法结构1:

UPDATE table_name1,table_name2

SET table_name1.column1 = value1

WHERE condition1

AND condition2

2.3 MySQL数据库语法结构2:

UPDATE table_name1 INNER JOIN table_name2

ON table_name1.column1 = table_name2.column1

SET table_name1.column2 = value2

SQLupdate语句怎么写