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.

Thank You 🤗

🎉 We appreciate your participation in our study.

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

You have attempted of activities on this page