Beyond Basics: Exploring Advanced Table Naming in SQLite
- Valid characters: SQLite is very permissive. You can use letters, numbers, many symbols (like
!
,@
,#
,$
, etc.), and even spaces (though spaces are not recommended). - Reserved names: The one restriction is that you cannot use names that start with "sqlite_". These names are reserved for internal use by SQLite itself.
- Case sensitivity: SQLite considers table names case-sensitive. So, "Customers" and "customers" would be considered different tables.
- Dots (periods): While technically allowed, it's best to avoid using dots (periods) in table names. They can make your SQL queries more complex to write.
- Keywords and special characters: You can even use SQL keywords (like TABLE) or special characters within quotes (like '') for table names, but this is generally not recommended for readability.
customer_orders
(clear, descriptive, uses lowercase with underscores)user_data
(simple and informative)product_information
(more descriptive)
Allowed, but not recommended:
1st_customers
(starts with a number, not ideal)- "New Customers" (uses spaces, can cause issues in queries)
specialChars!@#$
(uses special characters, less readable)TABLE_data
(uses a reserved keyword, can be confusing)MyTable.extension
(uses a dot, can complicate queries)
prefix = "user_"
user_id = 123
table_name = prefix + str(user_id) # table_name becomes "user_123"
sql sqlite