MySQL Forums
Forum List  »  Newbie

Re: simple query. why series column is giving problem
Posted by: Peter Brawley
Date: July 22, 2020 09:20AM

DROP TABLE IF EXISTS equities;
CREATE TABLE `equities` (
  `symbol` varchar(16) DEFAULT NULL,
  `series` char(2) DEFAULT NULL,
  `date1` date DEFAULT NULL,
  `close_price` decimal(8,4) DEFAULT NULL,
  PRIMARY KEY(symbol,series,date1)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
INSERT INTO `equities` VALUES ('TATASTEEL','E1','2019-06-27',66.9500),('TATASTEEL','EQ','2019-06-27',510.7000),('TATASTEEL','E1','2019-10-01',37.7500),('TATASTEEL','EQ','2019-10-01',351.5500),('TATASTEEL','E1','2019-10-03',37.1000),('TATASTEEL','EQ','2019-10-03',339.6000),('TATASTEEL','E1','2019-10-04',36.7000),('TATASTEEL','EQ','2019-10-04',333.1000);

select * 
from equities 
where symbol ='TATASTEEL' and series ='EQ' 
order by date1 limit 8;
+-----------+--------+------------+-------------+
| symbol    | series | date1      | close_price |
+-----------+--------+------------+-------------+
| TATASTEEL | EQ     | 2019-06-27 |    510.7000 |
| TATASTEEL | EQ     | 2019-10-01 |    351.5500 |
| TATASTEEL | EQ     | 2019-10-03 |    339.6000 |
| TATASTEEL | EQ     | 2019-10-04 |    333.1000 |
+-----------+--------+------------+-------------+


Options: ReplyQuote




Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.