Changes

An Overview of Android SQLite Databases in Android Studio

15 bytes added, 20:04, 27 October 2016
m
Text replacement - "<table border="0" cellspacing="0">" to "<table border="0" cellspacing="0" width="100%">"
<googlehtmlet>BUY_ANDROID_STUDIOandroidstudio</googlehtmlet>
== Introducing Database Schema ==
<googlehtmlet>ADSDAQBOX_FLOWadsdaqbox_flow</googlehtmlet>
Database Schema define the characteristics of the data stored in a database table. For example, the table schema for a customer database table might define that the customer name is a string of no more than 20 characters in length, and that the customer phone number is a numerical data field of a certain format.
create table contacts (_id integer primary key autoincrement, name text, address text, phone text);
</pre>
<googlehtmlet>BUY_ANDROID_STUDIOandroidstudio</googlehtmlet>
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.
<googlehtmlet>BUY_ANDROID_STUDIOandroidstudio</googlehtmlet>
 
<htmlet>ezoicbottom</htmlet>
<hr>
<table border="0" cellspacing="0" width="100%">