create table t(id int not null, a int default 0, b int default 0, c int default 0, primary key(id), key idx_a_b(a, b));下面语句能够利用到索引的是()
A: select b from t where a=10;
B: select * from t where a=10 and id=100;
C: select * from t where a=10 and b>100;
D: select * from t where a>10 and b < 100;
E: select * from t order by b limit 10;
A: select b from t where a=10;
B: select * from t where a=10 and id=100;
C: select * from t where a=10 and b>100;
D: select * from t where a>10 and b < 100;
E: select * from t order by b limit 10;
举一反三
- 下列语句没有语法错误的是()。 A: SELECT * FROM my table WHERE order=10 B: SELECT * FROM [my table] WHERE order=10 C: SELECT * FROM my table WHERE [order]=10 D: SELECT * FROM [my table] WHERE [order]=10
- 查询主键id从高到低排序的前10条记录的语句是() A: SELECT * FROM table ORDER BY id ASC limit 1,10 B: SELECT * FROM table ORDER id DESC limit 10 C: SELECT * FROM table ORDER BY id DESC limit 10 D: SELECT * FROM table ORDER id ASC limit 1,10
- MySQL数据库中查询前10条记录的SQL语句是()。 A: select top 10 from table B: select * from table limit 10 C: select * from table limit 1, 10 D: select * from table limit 0, 10
- 下面用于查询student表中id值在1,2,3范围内的记录的SQL语句是( )。 A: SELECT * FROM student WHERE id=1,2,3; B: SELECT * FROM student WHERE (id=1,id=2,id=3); C: SELECT * FROM student WHERE id in (1,2,3); D: SELECT * FROM student WHERE id in 1,2,3;
- 下面选项中,查询student表中id值不在2和5之间的SQL语句是( )。 A: SELECT * FROM `student` WHERE `id`!=2,3,4,5 B: SELECT * FROM `student` WHERE `id` NOT BETWEEN 5 AND 2 C: SELECT * FROM `student` WHERE `id` NOT BETWEEN 2 AND 5 D: SELECT * FROM `student` WHERE `id` NOT IN 2,3,4,5