You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
AQuery/stock.a

32 lines
851 B

CREATE TABLE stocks(timestamp INT, price INT)
INSERT INTO stocks VALUES(1,15)
INSERT INTO stocks VALUES(2,19)
INSERT INTO stocks VALUES(3,16)
INSERT INTO stocks VALUES(4,17)
INSERT INTO stocks VALUES(5,15)
INSERT INTO stocks VALUES(6,13)
INSERT INTO stocks VALUES(7,5)
INSERT INTO stocks VALUES(8,8)
INSERT INTO stocks VALUES(9,7)
INSERT INTO stocks VALUES(10,13)
INSERT INTO stocks VALUES(11,11)
INSERT INTO stocks VALUES(12,14)
INSERT INTO stocks VALUES(13,10)
INSERT INTO stocks VALUES(14,5)
INSERT INTO stocks VALUES(15,2)
INSERT INTO stocks VALUES(16,5)
3 years ago
SELECT max(price-min(timestamp)) FROM stocks
3 years ago
/*<k> "q1" </k>
*/
SELECT max(price-mins(price)) FROM stocks
3 years ago
SELECT price, timestamp FROM stocks where price - timestamp > 1 and not (price*timestamp<100)
3 years ago
/*
3 years ago
<k> "q3"</k>
SELECT max(price-mins(price))
FROM stocks
ASSUMING ASC timestamp
3 years ago
*/