As soon as you say "I create a table per user" this is an antipattern I call Metadata Tribbles. The problem is that these tables tend to reproduce out of control. :-)
Instead, you should create one table, with a column for the user's email as an attribute.
If you use delimited identifiers, SQL table names can contain special characters, or even whitespace, SQL reserved words, international characters, etc. But if you take the back-quotes off, @
and .
are not valid characters for an identifier, because it confuses the SQL parser. Think about this: do you use any other programming languages that accept .
as a valid character in a variable name or class name?
Other tips:
IP
is more easily stored as INT UNSIGNED
, and there are functions INET_ATON() and INET_NTOA() to convert an IP address string to and from the binary equivalent. This helps you make sure you don't accidentally store an invalid IP address. Also you can use bitwise binary operators to do subnet masking operations against an IP address in binary form.
The columns FLD1
, FLD2
, FLD3
etc. are not descriptive and indicate that you haven't designed this table sufficiently. You might even need to split this table into a few separate tables to manage multi-valued attributes. But one can't tell how to do this since your columns are named so abstractly.