vendredi 26 juin 2015

Is the sequence on how we type a Sqlite query to Create a column with attributes really matters

I'm new to coding android apps with Sqlite I have three questions I created this Sqlite table with columns with attributes like TEXT NOT NULL UNIQUE DEFAULT regular Q1) I'm skeptical to know whether is there any order on how to delare attributes for a row

Q2) If I declare any row to have a default value like will the text be still inserted even though the user inserts something in that row ,if Yes means then how to insert a default value if the user dosen't inset any value in a specific Row

Q3)Is my Code below correct ? what I desire is the row KEY_TAGNAME to be unique and not null and to have a value if the row doesn't get any data while a insert statement occurs for that table.

private static final String CREATE_TAGTABLE_SQL=
        "CREATE TABLE " + DATABASE_TABLE_TAG
        + " (" 
        + KEY_TAGROWID + " INTEGER PRIMARY KEY AUTOINCREMENT, "
        + KEY_TAGNAME + " TEXT NOT NULL UNIQUE DEFAULT regular"
        + ");";

Aucun commentaire:

Enregistrer un commentaire