in Databases
605 views
0 votes
0 votes
Consider the relations.

$Supplier(\underline{S_{id}}, S_{Name}, S_{rating})$

$Parts(\underline{P_{id}}, P_{name}, P_{color})$

$Catalog(\underline{S_{id},  P_{id}}, cost)$

$ \text{Que: Retrieve $S_{id}$’s supplied atleast 2 parts}$
 

SELECT $C_1.S_{id}$

FROM $\text{Catalog as $C_1$}$

GROUP BY ($C_{1}.S_{id} ,C_{1}.P_{id} $)

HAVING $count(*)  > 1;$

Please verify is this correct querry.
in Databases
by
605 views

4 Comments

then ( let sid is in range [1,10] and pid is in range [101,110])

1 101

1 102

are separate groups, right ?
0
0
yes
0
0
then you can't know is sid is participated more than one or not !
0
0

1 Answer

1 vote
1 vote

We can apply  group by clause in sid only .