From a64ff8200ca1d2f163ea0c302c494fc25b4e6d79 Mon Sep 17 00:00:00 2001 From: Sorrel Harriet <s.harriet@gold.ac.uk> Date: Sun, 6 Nov 2016 19:53:27 +0000 Subject: [PATCH] amend --- lab-5/vending-machine/sql/schema.sql | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/lab-5/vending-machine/sql/schema.sql b/lab-5/vending-machine/sql/schema.sql index 6c3dc41..e80b1f4 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; -- GitLab