Skip to content
Advertisement

issue with derby database on where condition

Below is my table structure.

I inserted one row with:

Now when I try to query as

i get an error saying:

Advertisement

Answer

Sorry, I can’t reproduce this one. Here’s a quick session in ij:

Note that I’ve had to change your CREATE TABLE statement in order to create the table. The CREATE TABLE statement in your question is not valid; I get a ‘Syntax error’ when I attempt to run it.

EDIT: now that you’ve provided the actual SQL script used to create the table, I can explain the difference.

The difference is that you have specified double-quotes around the column names. Doing that makes the column names case-sensitive. You then have to use double-quotes when querying the table, unless the column names are all upper-case. If you don’t specify double-quotes around a name, the name is treated as if it was all upper-case.

Here’s how to query your table as originally specified:

(I haven’t bothered to insert any data this time, but hopefully you should still get the point: the query completes without error.)

Note that the column headers this time are in lower-case, whereas the column headers in the first section of output above were in upper-case.

User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement