Android examples for Database:Primary Key
create table with integer PRIMARY KEY auto increment
//package com.java2s; import android.database.sqlite.SQLiteDatabase; import android.util.Log; public class Main { public static SQLiteDatabase db; public static String workname = "worklist"; public static void createWorktable() { try {/*from w ww .jav a 2s . c om*/ db.execSQL("create table if not exists " + workname + "(" + " _id integer PRIMARY KEY autoincrement, " + " cownumber text," + " year text," + " month text, " + " day text, " + " hour text, " + " min text, " + " simplememo text, " + " resetNum text);"); } catch (Exception ext) { Log.d("Create table fail", "table make fail"); } } }