Spacing is necessary in creating table before quote


I tired to find the bug in my code of chapter 14 database. finally i get it to be spacing problem.
db.execSQL(“create table” + CrimeTable.NAME + “(” +… space was necessary between create table and the quote. i wrote it like this and works.
db.execSQL("create table " + CrimeTable.NAME + “(” +
this is very strange idea to me. please any more thing you know about this…


The reason is simply just SQL language syntax(format). Your original SQL statement reads like this:
create tableTable Name( vs the correct syntax create table Table Name(

That space is important because without it the keyword “create table” is not recognize by the SQL database.

Here is another example:
this is a classic SQL statement: SELECT * FROM Table Name.
if I write it like this: SELECT*FROMTable Name the SQL complier cannot read the different keywords thus it won’t retrieve any data.

Hope this helps.


thanks! it was helpful,