Problem Bank for Pre Test Problems

We use SQL to manage the equipment in a gym. Our current table equipment looks like this:

https://i.ibb.co/zbxr8M6/pretest-equipment.png

To help us refill some sport equipments that are low in stock, please write a SELECT statement to retrieve the name and brand of all items in the table equipment that belongs to sport category of “table_tennis” and has a quantity of less than 10.

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.

In the same equipment table:

https://i.ibb.co/zbxr8M6/pretest-equipment.png

We just bought more equipment for table tennis.

Please write an UPDATE statement that: for all entries which sport column is table_tennis, add the quantity by 5.

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.

Aside from the equipment table:

https://i.ibb.co/zbxr8M6/pretest-equipment.png

As students can rent items from the gym, we have another table rental:

https://i.ibb.co/7WNs12N/pretest-rental.png

Where the equipment_id in this table refers to the id in the equipment table above. To provide sports-related recommendations for people, we want to know when each individual played a certain sport.

Please write a statement using SELECT and JOIN to: select the sport from the equipment table and name and date from the rental table, where the equipment_id in the rental table is the same as the id in the equipment 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.

You have attempted 1 of 4 activities on this page