create table tbl1(rno int, name varchar(10))
insert into tbl1 values(101, 'neha')
alter table tbl1 add city varchar(10)
select * from tbl1
在此代码中,我将记录插入city列。我也试过了代码,但是这个不正确的代码需要帮助来添加记录。
insert into tbl1 (city)
SELECT CITY
FROM tbl1
WHERE rno = 1
update tbl1
set city = 'pune'
where rno = 1;
第二个查询返回“0记录更新”ans。
答案 0 :(得分:1)
您在表格中插入的行有rno = 101
- 因此您的UPDATE
语句必须如下所示:
update tbl1
set city = 'pune'
where rno = 101; -- use **101** here - not **1** !!