I am creating an android application where tables are created dynamically having email (for example:abcd@efg.com) as their table name. Later I learned that table names cannot have special characters like "@".
Please suggest me a way by which I can create tables with special characters like "@" and "." in the table name.
Asked
Active
Viewed 895 times
-1

Brian Tompsett - 汤莱恩
- 5,753
- 72
- 57
- 129

Tony Mathew
- 880
- 1
- 12
- 35
-
Is this [tag:sqlite] or [tag:mysql]? It's currently tagged with both. – Mureinik Jul 30 '16 at 14:15
-
1I am not certain why you think that having a table per email address is the appropriate solution. Even if it is, use a supported table name (sequentially or randomly generated), and have a table that maps email addresses to table names. – CommonsWare Jul 30 '16 at 14:16
-
@Mureinik: Its SQLite. Do you have a solution for the problem? – Tony Mathew Jul 30 '16 at 14:21
2 Answers
1
This is too long for a comment. The brief answer is that SQLite supports both double quotes and square braces for escaping identifiers.
However, the correct answer is that I cannot imagine why a separate table would be created for each email. An email address is typically an attribute of an entity, and hence a column. Even if an email address represented an entity itself, then you would want to store multiple emails in a single table with the email as a primary key.
If, for some reason, you need temporary tables for some processing for individual users, then use create temporary table
.

Gordon Linoff
- 1,242,037
- 58
- 646
- 786