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

备考刷题,请到

CDA认证小程序

(复合题)学生信息表 student 包含 id(学生编号)和 stuname(学生姓名)。 (2)以下哪个语句可以用来删除 student 表中的 id 字段?
A. update table student delete id;
B. drop id from student;
C. delete id from student;
D. alter table student drop id;
上一题
下一题
收藏
点赞
评论
题目解析
题目评论(0)

对表进行增加、修改及删除字段操作时应使用 alter table 语句,只有 D满足条件。

正确答案是 D: alter table student drop id;

专业分析:

- A: `update table student delete id;` 这个语句是错误的,因为 `UPDATE` 语句用于更新表中的记录,而不是删除表中的字段。

- B: `drop id from student;` 这个语句是错误的,因为 `DROP` 语句通常用于删除整个表或数据库,而不是删除表中的字段。

- C: `delete id from student;` 这个语句是错误的,因为 `DELETE` 语句用于删除表中的数据记录,而不是删除表中的字段。

- D: `alter table student drop id;` 这个语句是正确的。`ALTER TABLE` 语句用于修改表的结构,包括添加、删除或修改字段。`DROP` 子句用于删除表中的字段。因此,`alter table student drop id;` 是删除 `student` 表中 `id` 字段的正确语句。