fork download
  1. CREATE TABLE Chefs
  2. (Chef VARCHAR(1) NOT NULL,
  3. Dish VARCHAR(30) NOT NULL);
  4.  
  5. INSERT INTO Chefs(Chef, Dish)
  6. values
  7. ('A', 'Apple pie'),
  8. ('A', 'Beignet'),
  9. ('A', 'Andes Chocolate Cake'),
  10. ('B', 'Tiramisu'),
  11. ('B', 'Creme brulee'),
  12. ('B', 'Beignet'),
  13. ('C', 'Tiramisu'),
  14. ('C', 'Creme brulee'),
  15. ('D', 'Apple pie'),
  16. ('D', 'Tiramisu'),
  17. ('D', 'Creme brulee'),
  18. ('E', 'Apple pie'),
  19. ('E', 'Bananas Foster'),
  20. ('E', 'Creme brulee'),
  21. ('E', 'Tiramisu');
  22.  
  23.  
  24. CREATE TABLE menu
  25. (Dish VARCHAR(30) NOT NULL);
  26.  
  27. INSERT INTO menu(Dish)
  28. values
  29. ('Creme brulee'),
  30. ('Apple pie'),
  31. ('Tiramisu');
  32.  
  33. /*
  34. Select Chef as Chef
  35. From Chefs
  36. Where 3 = (Select Count(c.Chef)
  37. From Chefs c
  38. Where c.Dish IN (Select Dish
  39. From menu));
  40. */
  41.  
  42. Select c.Chef, COUNT(c.Chef)
  43. From Chefs c
  44. Where c.Dish IN (Select Dish
  45. From menu);
  46.  
  47.  
Success #stdin #stdout 0s 4524KB
stdin
Standard input is empty
stdout
A|11