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

备考刷题,请到

CDA认证小程序

查询student表中记录数可以使用如下语句( )
A. select count() from student
B. select count(*) from student
C. select columns() from student
D. select columns(*) from student
上一题
下一题
收藏
点赞
评论
题目解析
题目评论(0)

在sql中用count语句进行记录数统计,count(*)表示统计所有记录数。

正确答案是:B: `select count(*) from student`

分析:

- A: `select count() from student`
这个语句是错误的,因为 `count()` 函数需要一个参数,比如列名或星号 `*`,来指明要统计的内容。

- B: `select count(*) from student`
这个语句是正确的。`count(*)` 会统计表中所有行的数量,包括所有列。这是一个常用的查询记录总数的方式。

- C: `select columns() from student`
这个语句是错误的,因为 SQL 中没有 `columns()` 这样的函数。通常,用 `information_schema` 或 `sys` 表来查询列信息。

- D: `select columns(*) from student`
这个语句也是错误的,同样因为不存在 `columns()` 这样的函数。

因此,B 是正确的选项,`select count(*) from student` 是查询 `student` 表中记录数的正确语句。