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

备考刷题,请到

CDA认证小程序

The "student" table has 4 fields: StudentID (student ID), Class (class), CourseID (course ID), Score (score). Which of the following statements about the usage of DISTINCT is incorrect?
A. SELECT DISTINCT StudentID FROM student;
B. SELECT DISTINCT StudentID, Class FROM student;
C. SELECT StudentID, DISTINCT Class FROM student;
D. SELECT COUNT(DISTINCT StudentID) FROM student;
上一题
下一题
收藏
点赞
评论
题目解析
题目评论(0)

The correct usage is to place the DISTINCT keyword before the first field. So, option C is incorrect..

正确答案是:C: SELECT StudentID, DISTINCT Class FROM student;

专业分析:

1. **A: SELECT DISTINCT StudentID FROM student;**
- 这条语句是正确的。它会从 `student` 表中选择所有不同的 `StudentID`。

2. **B: SELECT DISTINCT StudentID, Class FROM student;**
- 这条语句也是正确的。它会从 `student` 表中选择所有不同的 `StudentID` 和 `Class` 组合。

3. **C: SELECT StudentID, DISTINCT Class FROM student;**
- 这条语句是错误的。`DISTINCT` 关键字不能在列名之前单独使用。`DISTINCT` 应该放在 `SELECT` 关键字之后,用来去重整个结果集。

4. **D: SELECT COUNT(DISTINCT StudentID) FROM student;**
- 这条语句是正确的。它会计算 `student` 表中不同 `StudentID` 的数量。

因此,选项 C 是不正确的。