If I wanted to name my table the current date in my application, would that be a variable schema name for the table and what would be the best way to handle it?
Asked
Active
Viewed 160 times
0
-
1See this post http://stackoverflow.com/questions/3694276/what-are-valid-table-names-in-sqlite – Justin Conroy Oct 09 '16 at 20:39
-
2This just sounds like a bad idea. How are you going to remember the name of your table? – Jahnold Oct 09 '16 at 20:42
-
3Put all that data into a single table, with the date as a column. – CL. Oct 09 '16 at 20:57
-
1I'll be also recommend a single table. You can filter for a date with a WHERE – OneCricketeer Oct 09 '16 at 20:58
-
Thanks all for the responses and information. I was mainly thinking that since my app will collect the same type of data every day and not change, as far as what is being collected with the app, then it would always be known what the tables contained no matter what they were named since the name of the Database itself, will be indicative of same. – J2112O Oct 10 '16 at 18:44
1 Answers
1
Doing that sounds like a bad idea because you won't be able to remember what kind of tables you have unless:
- You have a table for your dates. This will help you determine what dates you already have and their appropriate table names.
Also, depending on the date format that you're using, you may end up with special characters in your table name which could cause your application to crash unless:
- You use
DatabaseUtils.sqlEscapeString(date)
: This will ensure that any special characters are escaped appropriately.
I'd personally use the second option if I was to use a date as a table name to avoid any errors.

Razor
- 1,778
- 4
- 19
- 36
-
Thanks for the suggestions and advice. All the tables will basically contain the same thing since the app is setup to collect only data from one certain item. I was thinking that if they are named by date, then the user, or myself could look back and say well on Tuesday I collected how many units and what are the attributes or something along those lines. – J2112O Oct 10 '16 at 18:47
-
You're welcome! But remember to create a table for your dates so you can keep track of them to avoid any hassles. – Razor Oct 10 '16 at 19:47