Hi there,
I have the following table schema in my h2 database:
CREATE TABLE STOCK_INFO
(
CODE VARCHAR(4),
REMARKS VARCHAR(20),
PRICE_DATE DATE,
LAST DECIMAL(9,2),
HIGH DECIMAL(9,2),
LOW DECIMAL(9,2),
PREVIOUS DECIMAL(9,2),
OPEN DECIMAL(9,2),
BUY DECIMAL(9,2),
SELL DECIMAL(9,2),
VOLUME INT,
BUY_VOLUME INT,
SELL_VOLUME INT,
PERCENTAGE_CHANGE DECIMAL(6,3),
CHANGE DECIMAL(6,3),
LAST_UPDATE TIMESTAMP DEFAULT NOW(),
PRIMARY KEY (CODE, PRICE_DATE),
);
This table holds 10465 records.
And so, I ran these queries:
select count(*) from stock_info;
select distinct price_date from stock_info order by price_date ;
select * from stock_info where price_date = '2009-11-26';
select count(*) from stock_info where price_date = '2009-11-26';
select price_date, count(price_date) from stock_info group by
price_date;
select count(*) from stock_info;
COUNT(*)
10465
(1 row, 0 ms)
select distinct price_date from stock_info order by price_date ;
PRICE_DATE
2009-11-15
2009-11-17
2009-11-18
2009-11-19
2009-11-26
2009-12-05
2009-12-08
2009-12-09
(8 rows, 187 ms)
select * from stock_info where price_date = '2009-11-26';
CODE REMARKS PRICE_DATE LAST HIGH LOW PREVIOUS OPEN
BUY SELL VOLUME BUY_VOLUME SELL_VOLUME PERCENTAGE_CHANGE
CHANGE LAST_UPDATE
(no rows, 230 ms)
The problem:
Notice that the first query returns a record containing the date value
'2009-11-26' in the PRICE_DATE column. However, an actual query on the
table with price_date = '2009-11-26' specified in the WHERE clause did
not return any results. Why is this so? Corruption of index? The
second query returns rows if I change price_date to 2009-11-19.
Thanks in advance.
--
You received this message because you are subscribed to the Google Groups "H2
Database" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/h2-database?hl=en.