一:上码
-- 查询至少生产三种不同速度PC的厂商-- 分析:1.联合pc和product表,字段为厂商和速度 表1
-- 2.按厂商名字进行分组统计厂商的个数,筛选条件为个数大于3的 表2
-- 3.将表2 做为子表筛选出 maker-- 1.
-- select maker,speed
-- from pc,product
-- where pc.model = product.model;-- -- 2.
-- select maker,count(maker)
-- from (select maker,speed
-- from pc,product
-- where pc.model = product.model) AS temp
-- group by maker having count(maker) >= 3;-- 3.select maker from (select maker,count(maker)from (select distinct speed,makerfrom pc,productwhere pc.model = product.model) AS tempgroup by maker having count(maker) >= 3) as temp2;