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.
23 lines
631 B
23 lines
631 B
3 years ago
|
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)
|
||
|
|
||
|
SELECT max(price-mins(price))
|
||
|
FROM stocks
|
||
|
ASSUMING ASC timestamp
|