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

备考刷题,请到

CDA认证小程序

Table t1 has id, name and salary columns. If t1 is a post info table for a forum, with id as the poster's ID, name as post title, and salary as points awarded by the forum per post, then: To view the row in t1 where id equals 10:
A. select * from t1 id=10;
B. select * from t1 where id=10;
C. select * from t1 id 10;
D. select * from t1 where id 10;
上一题
下一题
收藏
点赞
评论
题目解析
题目评论(0)

To view specific rows, need to use the WHERE + condition clause form to constrain the data output.

正确答案是:B: `select * from t1 where id=10;`

专业分析如下:

1. **SQL语句的基本结构**:
- SQL查询语句的基本结构是 `SELECT 列名 FROM 表名 WHERE 条件;`
- 在这个结构中,`SELECT` 后面跟的是要查询的列名,`FROM` 后面跟的是表名,`WHERE` 后面跟的是查询的条件。

2. **选项分析**:
- A: `select * from t1 id=10;` 这个语句缺少了 `WHERE` 子句,因此是错误的。
- B: `select * from t1 where id=10;` 这个语句符合 SQL 查询的基本结构,正确地使用了 `WHERE` 子句来指定查询条件,因此是正确的。
- C: `select * from t1 id 10;` 这个语句同样缺少了 `WHERE` 子句,并且语法结构不正确,因此是错误的。
- D: `select * from t1 where id 10;` 这个语句虽然有 `WHERE` 子句,但是缺少了等号 `=`,因此是错误的。

因此,正确答案是 B。