Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo
The HSQL Database Manager can populate an empty database with test data (Options > Insert test data) to speed up running some tests. The test schema consists of four tables (customer, product, invoice, item). But it seeme like the test data is inconsistent.
E.g. the invoice with id=0 shows total cost of 5294.10, but when I run
SELECT sum(cost) FROM "PUBLIC"."ITEM" where invoiceid=0
I get 415.50 as cost, which is inconsistent.
Is the data really inconsistent? In that case it would good to fix this. Or do I misunderstand the schema?
Please check the source code of org.hsqldb.util.DatabaseManagerCommon and change the queries if necessary.
This shows the values that go into INVOICE. Note the cost is product cost, which has to be multiplied by quantity.
select invoiceid, sum (cost * quantity) from item group by invoiceid
You are right fredt. I changed the query to
SELECT sum(cost*quantity) FROM "PUBLIC"."ITEM" where invoiceid=0
and the result is consistent with invoice with invoiceId=0. Thanks you for clarifying this.
I found another inconsistency. The product with id=0 has a price of 17.00. But item-table references productId=0 with costs of 25.50. The same is true for other product IDs as well. E.g. product with ID=1 has a cost of 7.50 in item-table.
Shouldn't be price in product-table and cost in item-table be the same?