Search code examples
androiddatabaseprimary-keyandroid-sqliteauto-increment

Is it possible to autoincrement a column which is not primary key


I have two columns Index and path. Because of present logic of my code I want path to be primary key and also Index to be auto Increment. Is this possible?


Solution

  • A GUID value is intended to be unique across tables and even databases so, make the auto_increment column primary index and make a UNIQUE index for the GUID. I think this is what you need.