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

备考刷题,请到

CDA认证小程序

使用sql命令将学生表student中的学生年龄age字段的值增加1岁,应该使用的命令是()
A. update set age with age+1
B. replace age with age+1
C. update student set age=age+1
D. update student age with age+1
上一题
下一题
收藏
点赞
评论
题目解析
题目评论(0)

修改表中某个字段值的语法:update 表名 set 字段名=计算公式

正确答案是:C: update student set age=age+1

专业分析:
在SQL中,`UPDATE`语句用于修改表中的现有记录。其基本语法为:

```sql
UPDATE table_name
SET column1 = value1, column2 = value2, ...
WHERE condition;
```

具体到这个问题,要求将学生表`student`中的学生年龄`age`字段的值增加1岁。正确的SQL命令应该是:

```sql
UPDATE student
SET age = age + 1;
```

选项分析:
- A: `update set age with age+1` 语法错误,`UPDATE`语句需要指定表名。
- B: `replace age with age+1` 语法错误,`REPLACE`不是用于更新表中数据的标准SQL命令。
- C: `update student set age=age+1` 语法正确,符合标准SQL语法。
- D: `update student age with age+1` 语法错误,`UPDATE`语句的`SET`部分不正确。

因此,正确答案是选项C。