I need some help to complete a query in SQL-Oracle. I trying to have it select the row(s) or security/ies with the highest or max gain from price1 to price2. here is what i have already. When I try to use sub queries in the select or where clauses, fails....and also i cannot use queries that are hard-quoted because the data in the table will increase periodically to 1000 securites. Any help is appreciated
My query:
select security,
price1,
price2,
((price2 - price1)/price1)*100 as Percentage
FROM market
My table and data
CREATE TABLE market
(security VARCHAR2(30) PRIMARY KEY,
PRICE1 NUMBER(6, 2),
PRICE2 NUMBER(6, 2));
INSERT INTO market VALUES('A', 62, 178);
INSERT INTO market VALUES('B', 80, 328);
INSERT INTO market VALUES('C', 72, 736);
INSERT INTO market VALUES('D', 270, 565);
INSERT INTO market VALUES('E', 570, 665);
INSERT INTO market VALUES('F', 400, 1640);
INSERT INTO market VALUES('G', 800, 3280);
COMMIT;