Problem Bank for Post Test Problems

We use SQL to manage a vending machine. Our current table goods looks like this:

https://i.ibb.co/hWd4CJG/posttest-goods.png

To help us refill goods that are low in stock, please write a SELECT statement to retrieve the name and brand of all items in the table goods that belongs to type of “chips” and has a quantity of less than 15.

note: When you run the code, there will be several execution results. Please only refer to the last execution result for debugging purposes.

In the same goods table:

https://i.ibb.co/hWd4CJG/posttest-goods.png

We just bought more chips.

Please write an UPDATE statement that: for all entries which type column is chips, add the quantity by 10.

note: When you run the code, there will be several execution results. Please only refer to the last execution result for debugging purposes.

Aside from the goods table:

https://i.ibb.co/hWd4CJG/posttest-goods.png

We have another table transactions that looks like this:

https://i.ibb.co/B4H3WXb/posttest-transactions.png

Where the goods_id in this table refers to the id in the goods table above.

To provide better service, we want to know when people purchased a type of item and how they paid.

Please write a statement using SELECT and JOIN to: select the type from the goods table and method and date from the transactions table, where the goods_id in the transactions table is the same as the id in the goods table.

note: When you run the code, there will be several execution results. Please only refer to the unittest and the last execution result for debugging purposes.

Before you keep reading...

Making great stuff takes time and $$. If you appreciate the book you are reading now and want to keep quality materials free for other students please consider a donation to Runestone Academy. We ask that you consider a $10 donation, but if you can give more thats great, if $10 is too much for your budget we would be happy with whatever you can afford as a show of support.

Thank You 🤗

🎉 We appreciate your participation in our study.

We will provide the answer of the questions in a separate link soon.

If you have questions or feedback, or want to know more, please contact Zihan Wu (ziwu@umich.edu).

You have attempted 1 of 4 activities on this page