1.2022 shopee 财物/审计
有订单表orders,包含字段用户信息userid,字段产品信息productid,以下语句能够返回至少被订购过两次的productid?
A select productid from orders where count(productid)>1
B select productid from orders where max(productid)>1
C select productid from orders group by productid having count(productid)>1
D select productid from orders where having count(productid)>1 group by productid
2.2021 搜狐畅游 财物/审计
SQL中常用的条件表达式有
A case when
B if else
C if else when
D switch
3.2022 shopee 财物/审计
为了更新amount值,下列写法正确的是?
A Update Count set amount=200 where count_id = 1000032
B Update from Count set amount=200 where count_id = 1000032
C Update amount=200 where count_id = 1000032
D Update amount=200 from Count where count_id = 1000032
update 表名 set 字段=value where 条件
4.2021 搜狐畅游 财物/审计
SQL中用于将某种数据类型的表达式显式转换为另一种数据类型的函数是
A concat
B isnumeric
C change
D cast
cast:将某种数据类型的表达式显式转换为另一种数据类型。
concat:将两个字符串连接起来,形成一个单一的字符串。
isnumeric:测试有效数字的数值函数。
change:修改字段名
5.2022 星环科技 财物/审计
对于满足SQL92标准的SQL:select foo, count(foo) from pokes where foo>10 group by foo having count(*)>5 order by foo, 执行顺序为
A FROM GROUP BY WHERE HAVING SELECT ORDER BY
B FROM WHERE GROUP BY HAVING SELECT ORDER BY
C FROM WHERE GROUP BY HAVING ORDER BY SELECT
D FROM WHERE ORDER BY GROUP BY HAVING SELECT
标准的 SQL 的解析顺序为:
(1).FROM 子句, 组装来自不同数据源的数据 (2).WHERE 子句, 基于指定的条件对记录进行筛选 (3).GROUP BY 子句, 将数据划分为多个分组 (4).使用聚合函数进行计算 (5).使用 HAVING 子句筛选分组 (6).计算Select所有的表达式 (7).使用 ORDER BY 对结果集进行排序