Hi Dennis,

Declaring the column as integer does not prevent you from storing strings:

SQLite version 3.6.0
Enter ".help" for instructions
sqlite> BEGIN TRANSACTION;
sqlite> CREATE TABLE test_table (ID INTEGER PRIMARY KEY, ExternalID2 INTEGER,
   ...> ExternalID
   ...>  INTEGER, Value INTEGER);
sqlite> INSERT INTO "test_table" VALUES(1007,1,37,'-5');
sqlite> INSERT INTO "test_table" VALUES(1044,4,37,'-10');
sqlite> INSERT INTO "test_table" VALUES(1081,2,37,'-20');
sqlite> INSERT INTO "test_table" VALUES(2081,2,37,'fred');
sqlite> INSERT INTO "test_table" VALUES(3081,2,37,'bill');
sqlite> INSERT INTO "test_table" VALUES(1118,3,37,'-1');
sqlite> INSERT INTO "test_table" VALUES(1155,5,37,'-7');
sqlite> COMMIT;
sqlite>
sqlite>
sqlite>
sqlite> select max( value ) from test_table;
fred
sqlite> select min( value ) from test_table;
-20
sqlite> select *, typeof( value ) from test_table;
1007|1|37|-5|integer
1044|4|37|-10|integer
1081|2|37|-20|integer
1118|3|37|-1|integer
1155|5|37|-7|integer
2081|2|37|fred|text
3081|2|37|bill|text
sqlite> select max( value ) from test_table where typeof( value ) = 'integer';
-1
sqlite>

Rgds,
Simon

2008/8/15 Dennis Volodomanov <[EMAIL PROTECTED]>:
>
>> Works just fine with 3.6.1 if you declare the Value column to be
>> INTEGER. As it is, I have no idea what collation is used, but the
>> Value column will be declared to default to TEXT values, as shown by
>>
>> select typeof(value) from test_table;
>>
> I haven't tried that, but I cannot declare it as INTEGER, because it
> contains strings as well (of course they're not selected to get min/max
> values). Would I need to write my own min/max functions to handle this?
>
> Thanks,
>
>  Dennis
>
>
> P.S. Sorry for the message I sent to you personally - the Reply-to
> button is too smart :)
>
> _______________________________________________
> sqlite-users mailing list
> sqlite-users@sqlite.org
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
>
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to