Difference in Ways of executing sql queries in android?

android, android-activity, android-context, sqlite

Solution

`managedQuery(...)` is a generic query mechanism which can be used for a variety of 'database' objects that have `ContentProviders`. This can include SQLite databases, phone contacts etc etc. It can only be used to 'query' for data and not make changes to the database.

`db.execSQL(...)` is a method call directly on a SQLite database and can be used to perform any SQL operation. This means not only can it 'query' (SELECT) data, but it can be used to create, alter, drop tables as well as insert, delete rows etc.

Problem

What is the difference between db.execSQL() method and activityObject.managedQuery() method in android ?

Original source