postgresql select problem? 
Author Message
 postgresql select problem?

Hi,

Before I can do jdbc, I was trying the following table and select, but it
doesn't give me what I want. Could you tell me what might be wrong? BTW,
I am running debian testing. Thanks.

                 Table "title"
 Attribute  |         Type          | Modifier
------------+-----------------------+----------
 title_id   | integer               |
 title_desc | character varying(10) |

mydb=# select * from title;
 title_id | title_desc
----------+------------
        1 |  Dr.
        2 |  Miss.

mydb=# select * from title where title_id = 2;
 title_id | title_desc
----------+------------
        2 |  Miss.

mydb=# SELECT * FROM title WHERE title_desc = 'Dr.';
 title_id | title_desc
----------+------------
(0 rows)

mydb=# SELECT * FROM title WHERE title_desc like 'M%';
 title_id | title_desc
----------+------------
(0 rows)

WHY ARE THE LAST TWO SELECT RETURNING NOTHING?



Mon, 28 Jun 2004 08:03:17 GMT
 postgresql select problem?

Hello Unkown person afraid of spam,

Quote:

> Before I can do jdbc, I was trying the following table and select, but it
> doesn't give me what I want. Could you tell me what might be wrong?
[...]
>  Attribute  |         Type          | Modifier
> ------------+-----------------------+----------
>  title_id   | integer               |
>  title_desc | character varying(10) |

               ^ Watch this!
Quote:
> mydb=# select * from title where title_id = 2;
>  title_id | title_desc
> ----------+------------
>         2 |  Miss.

             ^^ Compare to this
Quote:

> mydb=# SELECT * FROM title WHERE title_desc = 'Dr.';
> (0 rows)
[...]

> WHY ARE THE LAST TWO SELECT RETURNING NOTHING?

No need to shout, somebody put spaces before the titles. Check the output of:
SELECT * FROM title WHERE title_desc = ' Dr.';

BYtE
Philipp



Mon, 28 Jun 2004 17:02:36 GMT
 postgresql select problem?

Quote:

> Hello Unkown person afraid of spam,


>> Before I can do jdbc, I was trying the following table and select, but
>> it doesn't give me what I want. Could you tell me what might be wrong?
> [...]
>>  Attribute  |         Type          | Modifier
>> ------------+-----------------------+----------
>>  title_id   | integer               |
>>  title_desc | character varying(10) |
>                ^ Watch this!
>> mydb=# select * from title where title_id = 2;
>>  title_id | title_desc
>> ----------+------------
>>         2 |  Miss.
>              ^^ Compare to this

>> mydb=# SELECT * FROM title WHERE title_desc = 'Dr.'; (0 rows)
> [...]

>> WHY ARE THE LAST TWO SELECT RETURNING NOTHING?
> No need to shout, somebody put spaces before the titles. Check the
> output of: SELECT * FROM title WHERE title_desc = ' Dr.';

> BYtE
> Philipp

Philipp, thanks, that was the problem. I load the data from a comma
seperated file and as typing custom, I was placing spaces after the
commas.
...ad


Tue, 29 Jun 2004 07:49:15 GMT
 
 [ 3 post ] 

 Relevant Pages 

1. Problem with large select - PostgreSQL starts eating memory/disk

2. ERROR: SELECT DISTINCT ON with postgresql v 7.1.2

3. PostgreSQL JDBC and sub-select

4. PostgreSQL JDBC and sub-select

5. PostgreSQL JDBC and sub-select

6. slow select on postgresql jdbc

7. Selecting a list in PostgreSQL

8. select distinct painfully slow on my postgreSQl database

9. Selects within selects - problem with group bys.

10. Problem converting SELECT with embedded SELECTs

11. Problem with SELECT INTO when ordering by non-selected column

12. PostgreSQL Website : advocacy.postgresql.org


 
Powered by phpBB® Forum Software