create SQLiteDatabase Usage History Table with integer column type - Android Database

Android examples for Database:Table Column

Description

create SQLiteDatabase Usage History Table with integer column type

Demo Code


//package com.java2s;

import android.database.sqlite.SQLiteDatabase;

public class Main {
    private static void createUsageHistory(SQLiteDatabase db) {
        String sql = "CREATE TABLE usage_history(" + "package_name TEXT,"
                + "lat REAL, " + "lon REAL,"
                + "weekday INTEGER DEFAULT (strftime('%w', 'now')),"
                + "start_hour INTEGER DEFAULT (strftime('%H', 'now')),"
                + "use_second INTEGER DEFAULT 1,"
                + "created_at INTEGER DEFAULT (strftime('%s', 'now'))"
                + ")";
        db.execSQL(sql);/*from  w  w  w  . j a  va2 s .  c o  m*/
    }
}

Related Tutorials