# 每个供应商质量高于80成本低于50
with
t1 as(
    select
        supplier_id,
        component_id,
        quality_score,
        cost
    from
        supply_quality_cost
    where
        quality_score>80 and cost<50
)
,
t2 as(
    select
        supplier_id,
        supplier_name,
        component_name,
        quality_score,
        cost
    from
        t1
        left join components using(component_id)
        left join suppliers using(supplier_id)
    order by
        supplier_id,
        cost
)

select * from t2