January 2018
Intermediate to advanced
446 pages
12h 57m
English
For string columns, indexes that use only the leading part of column values, rather than the full column, can be created. You need to specify the length of the leading part:
## `last_name` varchar(16) NOT NULLmysql> ALTER TABLE employees ADD INDEX (last_name(10));Query OK, 0 rows affected (1.78 sec)Records: 0 Duplicates: 0 Warnings: 0
The maximum length of last_name is 16 characters, but the index is created only on the first 10 characters.
Read now
Unlock full access