0

Now I'm learning Android development, and while following my book, I just wondered why using capital letters for SQLite column names?

db.execSQL("CREATE TABLE DRINK (_id INTEGER PRIMARY KEY AUTOINCREMENT, "
                    + "NAME TEXT, "
                    + "DESCRIPTION TEXT, "
                    + "IMAGE_RESOURCE_ID INTEGER);")

Usually, I'm using small letters and _ only for Web developing.

Is there any reason for that? like code standard?

Phantômaxx
  • 37,901
  • 21
  • 84
  • 115
Expert wanna be
  • 10,218
  • 26
  • 105
  • 158

2 Answers2

12

SQL is case insensitive. You can use lower or uppercase characters. There seems to exist a general consensus for using capital letters for SQL keywords, camel case for tables, and lower case for fields, but that is not written in stone either.

If you do not have to follow imposed formatting guidelines, you can use whichever notation you prefer. Stick to that throughout your project, as that is a good habit to have.

Michaël Roy
  • 6,338
  • 1
  • 15
  • 19
0

It's just the coding standard with SQL. Some people use lowercase anyways, but for the most part I've seen all caps.