3 different queries from 2 tables I have three tables (palettes, boxes, layout) with sample values:

Palettes

|ID_P|sign|
|   1|  P1|
|   2|  P2|
|   3|  P3|
|   4|  P4|


Boxes

|ID_B|sign|
|   1|  B1|
|   2|  B2|
|   3|  B3|
|   4|  B4|


Layout

|ID_L|ID_P|ID_B|
|   1|   1|   1|
|   2|   2|   2|
|   3|   2|   3|
|   4|   3|   4|
|   5|   4|   4|


So I can have 3 cases:


One palete with one box (ID_L = 1)
One palette with more than one boxes on it (ID_L = 2,3)
One big box on more than one palette (ID_L= 4,5)


Now, I need to group it, so I need three separate queries, that will return:

for case 1: all ID_P's of 1:1 "relation"

for case 2: all ID_P's of 1:N "relation"

for case 3: all ID_P's pf N:1 "relation"

Basically I have sollutions for case 2 and 3, but have no idea how to get case 1.
Using sub queries this should extract all ID_Ps which only occur in the Layout table once and then INNER JOIN them with all ID_Bs which only occur in the Layout table once... essentially returning only ID_Ps with no more than one box per palette, and no more than one palette per box.

SELECT x.ID_P FROM  
  (SELECT ID_P, ID_B, COUNT(*) as count FROM Layout GROUP BY ID_P) x  
  INNER JOIN  
  (SELECT ID_P, ID_B, COUNT(*) as count FROM Layout GROUP BY ID_B) y   
WHERE x.count = 1 AND y.count = 1 AND x.ID_P = y.ID_P;