I think you should firstly go through a SQLITE tutorial (google this), and then use it inside b4a. Everything would be much clearer, since in b4a what you are using is execQuery and execNonQuery and cursors, all fundamental parts of sqlite (and sql in general).