This article for Bo Master Original, reproduced please indicate the source:
When the index is actually applied, an indexed SQL is added to the SQL in the table, and the application example is as follows:
CREATE TABLE tbl_camera_info (' cameraid ' varchar ( -) Not NULL COMMENT'lens unique number, unified monitoring platform', ' cameraname ' varchar ( -) Not NULL COMMENT'Lens name', ' clientId ' varchar ( -) Not NULL COMMENT'Customer number', ' clientName ' varchar ( -) DEFAULT NULL COMMENT'Owning Customer name', ' lasttime ' dateTime not NULL COMMENT'Last Modified Time', PRIMARY KEY (' Cameraid ', ' clientId ')) ENGINE INNODB DEFAULT CHARSET=utf8 comment='Lens Information Table';
A unique composite index of the Cameraid and ClientID's primary keys established above.
CREATE TABLE ' report_info ' (' ID ')int( One) Not NULL auto_increment COMMENT'self-increment sequence', ' cameraname ' varchar ( the) Not NULL COMMENT'Monitoring Point Name', ' clientName ' varchar ( the) Not NULL COMMENT'Customer Name', ' platid ' varchar (2) Not NULL COMMENT'Platform ID', ' Createtime ' datetime not NULL COMMENT'Opening Hours', ' Lasttime ' datetime not NULL COMMENT'Last update Time', PRIMARY KEY (' id '), index Report_camera_platid (platid ASC), index Report_camera_createtime (createtime DESC) ) ENGINE=innodb DEFAULT Charset=utf8 COMMENT ='Escalation Information Table';
The above table establishes the primary key index for the ID, the normal index, and adds the sort type for the normal index.
Physical sorting is the physical location where the records are stored, and the index sort is the equivalent of adding a book to the
A detailed directory (this directory can be based on the required requirements to determine the order, it is not recorded
The actual content recorded in the library, but only the location of each record in the library. Therefore, the amount of space required to build the index
is much smaller than physical sorting, and helps prevent data redundancy and the resulting data updates easily
resulting in inconsistencies in the data.
Establishment of normal indexes and sorting of ordinary indexes