The solution for calculating low stock (in screen 4) is wrongly sorted in ascending order.
The code:
SELECT productCode,
ROUND(SUM(quantityOrdered) * 1.0 / (SELECT quantityInStock
FROM products p
WHERE od.productCode = p.productCode), 2) AS low_stock
FROM orderdetails od
GROUP BY productCode
ORDER BY low_stock
LIMIT 10;
wrongly assumes that a higher priority for restocking is given to products with a lower "low_stock" value.
The code clearly shows that a lower value will correspond with a lower quantityordered and/or higher quantityInStock. This is clearly against the purpose stated in the project's instructions.
A simple correction can be made to the code by simply sorting by descending