考试报名
考试报名
考试内容
考试大纲
在线客服
返回顶部

备考刷题,请到

CDA认证小程序

Table t1 has id, name and salary columns. If t1 is a post info table for a forum, with id as the poster's ID, name as post title, and salary as points awarded by the forum per post, then: The statement to update field contents in table t1 is:
A. create table t1(id int,name char(30),salary int);
B. drop table t1;
C. create view v_t1 as select id,name from t1;
D. update t1 set name='lixiaoming' where id=100;
上一题
下一题
收藏
点赞
评论
题目解析
题目评论(0)

The UPDATE...SET statement is used to modify field contents in a table.

正确答案是:D: update t1 set name='lixiaoming' where id=100;

分析:
- 选项A: `create table t1(id int,name char(30),salary int);` 这个语句是用于创建一个名为t1的表,并定义了三个字段:id(整数类型)、name(字符类型,最大长度为30)、salary(整数类型)。这个语句是创建表结构的,而不是更新表中字段内容的。

- 选项B: `drop table t1;` 这个语句是用于删除名为t1的表。这个操作会删除整个表结构和表中的所有数据,同样不是更新字段内容的操作。

- 选项C: `create view v_t1 as select id,name from t1;` 这个语句是用于创建一个名为v_t1的视图,视图中包含t1表的id和name字段。视图是一个虚拟表,它是基于SQL查询的结果集,同样不是更新字段内容的操作。

- 选项D: `update t1 set name='lixiaoming' where id=100;` 这个语句是用于更新t1表中id为100的记录的name字段,将其值更新为'lixiaoming'。这正是更新表中字段内容的操作。

综上所述,只有选项D是用于更新表中字段内容的正确SQL语句。