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

备考刷题,请到

CDA认证小程序

To increase the age value of every student by 1 in table student, the correct SQL command is ____
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)

Syntax to modify column value: update table name set column name=expression

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

专业分析如下:

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

```sql
UPDATE 表名 SET 列名 = 新值 WHERE 条件;
```

在这个问题中,我们需要将`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`不是用来更新表中记录的正确关键字。
- C: `update student set age=age+1`:这是正确的语法,符合SQL标准。
- D: `update student age with age+1`:这个语法也是错误的,`UPDATE`语句中没有`with`关键字。

因此,选项C是正确的。