On Thu, Mar 25, 2010 at 5:06 PM, Igor Tandetnik <itandet...@mvps.org> wrote:
> P Kishor <punk.k...@gmail.com> wrote:
>> On Thu, Mar 25, 2010 at 4:44 PM, jose isaias cabrera
>> <cabr...@wrc.xerox.com> wrote:
>>> Create table test (t1 primary key, t2 secundary key, t3, t4);
>>
>>
>> I am pretty certain that SQLite has no idea what 't1 primary key'
>> means.
>
> No, it's perfectly OK. It means a column with no affinity, which also 
> constitutes a primary key.
>
>> Perhaps you meant to say 't1 integer primary key'?
>
> Unlikely, seeing as the OP insersts strings into it.
>
>> I am completely certain that SQLite has no idea what 't2 secundary
>> key' means.
>
> Well, actually, it means a column named t2 whose declared type is "secundary 
> key". Of course such a type has no special meaning to SQLite. One can as well 
> write "create table test(t2 here be dragons)" (which is a valid SQLite 
> statement).


You are absolutely correct re. "secundary key" not having any special
meaning to sqlite, which is precisely what I implied when I wrote
"SQLite has no idea what 't2 secundary key' means. It is pointless
syntax.

With regards to having a PK on a column with no affinity, I guess
things will just default to strings, no?

In any case, for OP's purpose, and esp. since he seems to be inserting
numbers as strings, as implied by the quoted numbers, he might benefit
from

CREATE TABLE test (
  t1 TEXT,
  t2 TEXT,
  t3 TEXT,
  t4 TEXT,
  PRIMARY KEY(t1, t2)
);

I don't know if INSERT or REPLACE will work in that case, but seems
like it should.


-- 
Puneet Kishor
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to