今天写sql碰到一个问题:
想要更新某张表中额字段 设置该字段为null
一开始用 update table A set 字段a is null where 字段b = 条件.
但是失败了 出现一个 [Err] ERROR: syntax error at or near "update";的错误.
查询资料之后 发现错误的原因是因为 字段a is null 表示是赋值 并没有更新的意思.
之后思考了之后 用了 update table A set 字段a = null where 字段b = 条件.
解决该问题.
补充:create table A as select 字段 from tableB where 条件; 可以复制表B 成表A(可以复制指定字段).
----------------------by 菜鸟学习路程