CREATE TABLE line_item (id INTEGER, qty INTEGER, unit_price REAL);
INSERT INTO line_item VALUES (1, 2, 3.0), (2, 5, 1.0), (3, 1, 9.0);
-- you can sort by a computed value
SELECT id, qty * unit_price AS total
FROM line_item
ORDER BY qty * unit_price DESC;ORDER BY a computed value