AUTOINCREMENT is not required unless you need to only automatically assign values to the primary key that are larger than any value ever used in the table. INTEGER PRIMARY KEY will assign a value max(column)+1 to the INTEGER PRIMARY KEY anytime a record is inserted where no value is provided for the INTEGER PRIMARY KEY column. AUTOINCREMENT is very rarely needed.
http://www.sqlite.org/autoinc.html >-----Original Message----- >From: [email protected] [mailto:sqlite-users- >[email protected]] On Behalf Of Stephen Chrzanowski >Sent: Thursday, 30 January, 2014 09:09 >To: General Discussion of SQLite Database >Subject: Re: [sqlite] Keeping Track of Records of IDs in one table. >Possible? > >There is a problem in the first group of SQL statements. The coffee >hadn't >set in, and I always find crap on a reread-after-submission. Should read >as >follows: > >Previously: create table Tasks (TaskID INTEGER PRIMARY KEY AUTOINCREMENT, >fkProjectID integer, TaskID integer, TaskName char, Completed Bool, >DateCompleted DateTime); >Working: create table Tasks (TaskID INTEGER PRIMARY KEY AUTOINCREMENT, >fkProjectID integer, TaskName char, Completed Bool, DateCompleted >DateTime); > >I had put two field TaskIDs in. Told ya the compiler was buggy. :] > >Old: >create view IncompleteTasks as select ProjectID, ProjectName, TaskID, >TaskName from Projects join Tasks on Projects.ProjectID=Tasks. >fkProjectID; >create view CompletedTasks as select ProjectID, ProjectName, TaskID, >TaskName, DateCompleted from Projects join Tasks on >Projects.Project=Tasks.fkProjectID; > >New: >create view IncompleteTasks as select ProjectID, ProjectName, TaskID, >TaskName from Projects join Tasks on Projects.ProjectID=Tasks. >fkProjectID where isnull(Completed) or Completed=0; >create view CompletedTasks as select ProjectID, ProjectName, TaskID, >TaskName, DateCompleted from Projects join Tasks on >Projects.Project=Tasks.fkProjectID where !IsNull(Completed) or Completed >!=0; > >I use [ Completed != 0 ] as some software defines TRUE as 1 while others >define TRUE as -1. > >On Thu, Jan 30, 2014 at 10:53 AM, jose isaias cabrera ><[email protected] >> wrote: > >> >> Wow! thanks for this. I have to read it slowly to capture the >> understanding of some of the syntax. But this is great! thanks. >> >> Stephen Chrzanowski" wrote... >> >_______________________________________________ >sqlite-users mailing list >[email protected] >http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users _______________________________________________ sqlite-users mailing list [email protected] http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

