金蝶的一道SQL笔试题
编辑: 面试啦 发布时间: 2023-06-12 02:21:40
表结构如下
————————————
Buyer Name Quantity
A 甲 2
B 乙 4
C 丙 1
A 丁 2
B 丙 5
请给出所有购入商品为两种或两种以上的购物人记录
select Buyer as 顾客,count(name) as 商品种类数 from table group by Buyer having count(name)>=2
select * from table where Buyer in (select Buyer from table group by Buyer having count(name)>=2)
————————————
Buyer Name Quantity
A 甲 2
B 乙 4
C 丙 1
A 丁 2
B 丙 5
请给出所有购入商品为两种或两种以上的购物人记录
select Buyer as 顾客,count(name) as 商品种类数 from table group by Buyer having count(name)>=2
select * from table where Buyer in (select Buyer from table group by Buyer having count(name)>=2)
上一篇:一套SQL笔试题 下一篇:SQL里面如何插入自动增长序列号字段
面试题库导航
- C++面试题
- JAVA面试题
- Oracle面试题
- MySQL面试题
- Linux面试题
- 网络工程师面试题
- 网管面试题
- 软件工程师面试题
- PHP面试题
- .net面试题
- 软件测试面试题
- EJB面试题
- Spring面试题
- Javascript面试题
- Python面试题
- QTP面试题
- Servlet面试题
- J2EE面试题
- Database面试题
- ASP面试题
- Unix面试题
- Loadrunner面试题
- 通信面试题
- 嵌入式面试题
- Ruby面试题
- Delphi面试题
- Mobile开发面试题
- SOA面试题
- JAVA面试题面试题
- 研发工程师面试题
- 软件架构师面试题
- 系统工程师面试题
- Android面试题
- JAVA程序员
- C#面试题