Hello.

I study little by little programming under the android. There is one question. How to create a database, already understood, to create a table - in principle, too. Here is the script:

public static final String SQL_CREATE_QUERY = "CREATE TABLE "+ TABLE_NAME + " (" + UID + "INTEGER PRIMARY KEY AUTOINCREMENT," + NAME + "varchar(255))"; 

But just to write it without errors, I almost ruined the laptop. Too many quotes, plus signs.

Is there any other way to create tables, maybe an automated service, or will you have to suffer with this syntax?

  • Andro and d. - falstaf
  • SQLite, android, quotes, have (no, no soft sign) - etki
  • @duddeniska, If you are given an exhaustive answer, mark it as correct (click on the check mark next to the selected answer). - Vitalina

1 answer 1

You can use any ORM (for example, OrmLite ) - they, as a rule, take care of creating tables. Or just write your statement builder , which takes less than half an hour.

Nor should we forget that SQLite is a typeless database, so the data types of the columns can be omitted (with the exception of autoincrement pk column).