mysql数据库update、delete、和insert into表的时候,如果要使用表别名,必须按照规范写法来写:

insert:

简写:insert into t_a a(a.id, a.name) values(1, ‘张三’),执行结果:报错

规范写法:还没查到怎么在insert的时候使用表别名

update:
简写:update t_a a set a.name = ‘张三’ where a.id = 1,执行结果:不报错,但是数据没有更新

规范写法:update a set a.name = ‘张三’ from t_a a where a.id = 1,执行结果:数据更新

delete:

简写:delete from t_a a where a.id = 1,执行结果:报错

规范写法:delete a from t_a a where a.id = 1,执行结果:正常删除

目前还没遇到要要使用别名的update,delete,insert场景,一般也用不到。

————————————————
版权声明:本文为CSDN博主「莫候」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/cainiaodejiaobu/article/details/77160123