sql至少查询语句,数据库高手近!

2024-11-17 03:45:13
推荐回答(5个)
回答1:

s1 只供应了 P1,P2两种零件吗?
select jno from spj
where pno in ('p1','p2')
group by jno
having count(*)=2

如果S1提供的零件没有明确说明:
select jno from spj
where pno in (select pno from spj where sid='s1')
group by jno
having count(*) = (select count(*) from spj where sid='s1' group by sid)

=====以上均测试通过(虽然不是很简洁 我再研究一下)=====

回答2:

select JNO from [表] where sno='s1'

回答3:

select jno from tableName where sno='s1' and jno in (select jno from tablename where sno='s1')

回答4:

S1所供应的全部零件 包括什么?

回答5:

select * from [表] where sno='s1'

其他复杂查询可以给我发信息 我能帮你