Changes

Jump to: navigation, search
no edit summary
create table contacts (_id integer primary key autoincrement, name text, address text, phone text);
</pre>
<google>BUY_ANDROID_STUDIO</google>
Note that each row in a table must have a primary key that is unique to that row. In the above example, we have designated the ID field as the primary key, declared it as being of type integer and asked SQLite to increment automatically the number each time a row is added. This is a common way to make sure that each row has a unique primary key. On most other platforms, the choice of name for the primary key is arbitrary. In the case of Android, however, it is essential that the key be named _id in order for the database to be fully accessible using all of the Android database related classes. The remaining fields are each declared as being of type text.

Navigation menu