下列哪些SQL语句可以查询出User表中name为张三的记录()。
A: SELECT * FROM User WHERE name = ’张三’
B: SELECT * FROM User WHERE name = ’张三’ LIMIT 0,1
C: SELECT * FROM User WHERE name LIKE ’张三’
D: SELECT * FROM User WHERE name LIKE ’%张三%’
A: SELECT * FROM User WHERE name = ’张三’
B: SELECT * FROM User WHERE name = ’张三’ LIMIT 0,1
C: SELECT * FROM User WHERE name LIKE ’张三’
D: SELECT * FROM User WHERE name LIKE ’%张三%’
举一反三
- 【多选题】下面语句可以实现查询user表中“zhangsan”的user,password,logins信息的是 A. select logins,user,password from user where name like ’%zhangsan%’; B. select user,password,logins, from user where name like ’zhangsan’; C. select password,logins,user from user where name=’zhangsan’ limit 1; D. select user,password,logins from user where name=’zhangsan’;
- 【单选题】从user表的name字段中找出名字包含“王大伟”的人,下面哪条select语句是正确的? A. Select * from user where 姓名 =’_王大伟_’ B. Select * from user where 姓名 =’%王大伟_’ C. Select * from user where 姓名 like ‘_王大伟%’ D. Select * from user where 姓名 like‘%王大伟%’
- 在tb_name表中创建一个名为name_view的视图,并设置视图的属性为name、pwduser,执行语句是什么?( ) A: CREATE VIEW name_view(name,pwd,user)AS SELECT name.pwd,user FROM tb_mame; B: SHOW VIEW name_view(name,pwd,user) AS SELECT name,pwd,user FROM tb_mame: C: DROP VIEW name_view(name,pwd,user) AS SELECT name,pwd,user FROM tb_mame: D: SELECT * FROM name_view(name,pwd,user) AS SELECT name,pwd,user FROM tb_ name:
- 以下可以正确运行的查询语句有( ) A: select * from user ; B: select * from user where username =’李四’; C: select * from user where 1=1; D: select distinct * from user;
- 若想查询student表中name为空值的记录,则正确的SQL语句是( )。 A: SELECT * FROM student WHERE name = NULL; B: SELECT * FROM student WHERE name like NULL; C: SELECT * FROM student WHERE name = 'NULL'; D: SELECT * FROM student WHERE name is NULL;