写出条件查询“表1 里的字段1的id是多少”()
A: select * from 表1 where字段1=“值”
B: select id from 表1 where字段1=“值”
C: select id from 字段1 where表1=“值”
D: select id from 表1
A: select * from 表1 where字段1=“值”
B: select id from 表1 where字段1=“值”
C: select id from 字段1 where表1=“值”
D: select id from 表1
举一反三
- 已知用户表 user 有多列,其中字段 id 没有 NULL 值,字段username有NULL值,选项中,不能获得 user 表的总记录数量的 SQL 语句是 A: SELECT COUNT (*) FROM user ; B: SELECT COUNT ( id ) FROM user ; C: SELECT COUNT ( username ) FROM user ; D: SELECT COUNT ( id ) FROM user WHERE 1=1;
- 下面用于查询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;
- 能够实现对局部变量赋值的选项是: A: SET 变量名=值; B: select字段1,字段2,...from表名where条件into变量1,变量2,... C: select字段1,字段2,...into变量1,变量2,...from表名where条件 D: DECLARE 变量名1 [, 变量名2] … 数据类型
- 查询student表中id字段值小于5,并且gender字段值为“女”的学生姓名的SQL语句是() A: SELECT name FROM student WHERE id<;5 OR gender='女'; B: SELECT name FROM student WHERE id<;5 AND gender='女'; C: SELECT name FROM student WHERE id<;5 ,gender='女'; D: SELECT name FROM student WHERE id<;5 AND WHERE gender='女';
- 请选择下面正确的SQL语句( ) A: select * from 表名 order by 列名1 and order by 列名2 B: select * from 表名 order by 列名1,列名2 C: select * from 表名 where 列1=值1 and 列2=值2 D: select * from 表名 where 列1=值1 and 列1=值2