diff --git a/lab-5/vending-machine/sql/schema.sql b/lab-5/vending-machine/sql/schema.sql index 6c3dc41e18b70c52fde5c2c47d9f6149e7826a5a..e80b1f4332df4ad9c8664cfd0e6b81a4b442bb76 100755 --- a/lab-5/vending-machine/sql/schema.sql +++ b/lab-5/vending-machine/sql/schema.sql @@ -25,4 +25,12 @@ INSERT INTO DrinkOption VALUES INSERT INTO Selection VALUES (NULL, 'A', '1'), +(NULL, 'A', '2'), (NULL, 'D', '0'); + +SELECT drink_name, code, price FROM DrinkOption ORDER BY code; + +SELECT do.drink_name, COUNT(s.id) FROM DrinkOption do +INNER JOIN Selection s +ON s.option_code=do.code +GROUP BY do.drink_name;