sqlite database: advanced SQL or redesign
I think the tables o_products, o_qtys, o_prices should be combined into a single table, with a one-to-many relationship with the orders table as follows:

order_details
(
    order_id INTEGER,
    order_item_id INTEGER,
    product_id INTEGER,
    price REAL,
    quantity INTEGER,
    PRIMARY KEY (order_id, order_item_id)
    FOREIGN KEY (order_id) REFERENCES Orders(o)
)


When you want to find out the total quantity of a given product, then 

SELECT SUM(quantity) 
FROM order_details
WHERE product_id = :product_id