Creating Database Tables and Indexes

This page discusses - Creating Database Tables and Indexes

Creating Database Tables and Indexes


In this section you will learn about describing the allowable syntax for identifiers in MySQL. The identifiers are Database, table, index, column and alias name. The following table describes the maximum length for each type of identifier.

Identifier Maximum length 
Database 64
table 64
column 64
Index  64
Alias 255

Some restriction on the character, which may appear in identifier are given below :

  • No identifier can contain ASCII 0 or byte with a value of 255.
  • Use of identifier quote character is permitted in identifiers. But avoidance of doing so if possible then it is best.
  • The MySQL identifiers table, column and database should not end with space character.
  • Database names cannot contain characters that are not allowed in directory name or  ' / ', ' \ ', ' - ',.
  • Table name cannot contain  '/ ', ' \ ', ' - ', or character are not allowed in a filename.
  • The identifier length is in bytes not in characters. But if you use multi-byte characters in identifier names then the maximum length will depend on the byte count of all the characters used.