SQL Format, Part 4 of 4
An identifier is a name chosen by you to identify an RDBMS object. This includes any object that can be created with the CREATE statement. This is how you create a database, table, primary index, foreign index, view, and many other objects. Each object must be a unique name within it’s scope.A database name must be unique on a database server.
A table and view name must be unique within a database.
A column, key, and constraint name must be unique within a table or view. This means that you can use the same column or key name in different tables if you wish.
Oracle and DB2 require an index name to be unique within a database.
SQL Server requires an index name to be unique within a table.
The rules for an identifier are:
> The name can be up to 128 characters in length, but MySQL only allows 64 characters maximum.
> The name must begin with a letter.
> The name can only contain letters, numbers, and an underscore (_). That means that the name can not contain any special characters or punctuation. Oracle allows the $ and # symbols, but it is recommended that you don’t use these symbols so that the code can be moved to other databases.
Use the underscore character to make names more readable, such as EMPLOYEE_LAST_NAME instead of EMPLOYEELASTNAME.
> The name can not match any reserved words (i.e. keywords). That’s because reserved words have special meaning to SQL.