On 14 Dec 2009, at 8:52am, Florian Schricker wrote:

>>> Primary keys are Oper, Product, Category, Name and CreateTS
>>   There is only one primary key per table.
> 
> So to say the primary key is "Oper, Product, Category, Name, CreateTS".

No.  Go read a boos on databases.  The shorter your primary key is, the faster 
everything works.  You want a very short primary key.  There would be no point 
in putting 'CreateTS' in your primary key unless it's possible for two records 
to exist which have the same "Oper, Product, Category, Name" but different 
CreateTS.  I might guess that your primary key is probably just Product.  If 
it's not possible to have two records with the same 'Product' then that is your 
primary key.

>>   I urge you to learn about database design and SQL.
>> [snip] Step back and do some learning before
>> you dig a big hole and fall into it.
> 
> I need to get things running quickly.

The advice is sound.  You cannot just guess at this thing and magically do it 
right.  For instance, a badly chosen primary key can completely mess up your 
entire database, giving it duplicate entries or having entries mysteriously 
disappear for no obvious reason.  You have given your own example of why you 
should read a book or two before you start.
> 
> Works fine - thank you. I chose a similar, see below.
> 
>> From: Simon Slavin <slav...@bigfraud.org>
> 
>>> - CreateTS (Timestamp)
> 
>> No such type in SQLite.  Take a look at
> 
> Ok this one seems to be some problem with me vs SQLite. I got the
> create clause for the table from somebody else inside my company (some
> DB2 guy) which is
> 
> CREATE TABLE MEASURE (
> [...]
> "CREATETS"  TIMESTAMP NOT NULL DEFAULT  CURRENT_TIMESTAMP,
> [...]

Yes.  DB2 has different field types to SQLite.  And MySQL, Progres, Oracle, and 
all other database engines each have different field types.  When converting a 
project from one to another you have to study what you have to change.

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

Reply via email to