Home >Database >Mysql Tutorial >What Characters Are Allowed in SQLite Table Names?
SQLite database table name rules
SQLite database is very flexible in the use of table name characters, allowing the use of a variety of character combinations. Alphanumeric combinations (A-Z, a-z, and 0-9) constitute valid table names.
It should be noted that the table name cannot start with a number to avoid confusion with integers. For example, CREATE TABLE 123abc(...)
is an invalid table name.
In addition to alphanumeric characters, SQLite allows the use of dashes ("-") in table names, but does not allow the use of periods ("."), which is different from the representation of database.table
. This means that CREATE TABLE 123abc.txt(...)
is an invalid table name, while CREATE TABLE 123abc-ABC.txt(...)
is valid.
Using quotes allows further flexibility, allowing any combination of characters to be a valid table name. Table names can be enclosed in double quotes ("), single quotes ('), or square brackets ([]). For example:
<code>"This should-be a_valid.table+name!?"</code>
<code>'This should-be a_valid.table+name!?'</code>
<code>[This should-be a_valid.table+name!?]</code>
Therefore, SQLite allows the use of unquoted and quoted table names, providing a variety of options for database design and data management.
The above is the detailed content of What Characters Are Allowed in SQLite Table Names?. For more information, please follow other related articles on the PHP Chinese website!