创建了一个名为“collegetable”的表:
create table collegetable (stid integer primary key not null,stname
varchar(50),department varchar(10),dateofjoin date);
为每列提供了值:collegetable data
在其中插入一个名为“cgpa”的新列,并尝试使用以下代码一次性为该列添加值:
WITH col(stid, cgpa) as
( VALUES((1121,8.01),
(1131,7.12),
(1141,9.86))
)
UPDATE collegetable as colldata
SET cgpa = col.cgpa
FROM col
WHERE colldata.stid = col.stid;
并收到错误:
ERROR:operator does not exist:integer=record
LINE9:where colldata.stid=col.stid;
HINT:No operator matches the given name and arguement type.you might need to add explicit type casts.
请提前帮助解决问题。
答案 0 :(得分:0)