关于SQLite中的函数db.execSQL()?

时间:2012-03-08 21:00:38

标签: android sqlite

我是初学者。我学习SQLite。我不懂函数 db.execSQL (DATABASE_CREATE);

private static final String DATABASE_CREATE = "create table users (_id integer primary key autoincrement, "  + "name text not null);"; 

所以函数db.execSQL()。怎么说的?请帮我。谢,

1 个答案:

答案 0 :(得分:8)

来自SQLiteDatabase的{​​{3}}:

execSQL(String sql): Execute a single SQL statement that is NOT a SELECT or any other SQL statement that returns data.

在您的示例中,要创建表,您将调用db.execSQL(DATABASE_CREATE),它将在您的应用程序的SQLite数据库上执行表create语句。