MySQL (default data table Myisam&inonodb)
Can be set in MySQL config file My.ini, the book is written in Default-table-type. But not found in the My.ini, but
# The default storage engine that would be used when create new tables when
Default-storage-engine=innodb
MyISAM, mature, stable, easy to manage. Divided into three kinds of MyISAM static, MyISAM dynamic and MyISAM compressed
- MyISAM Static: Data columns each have a defined "fixed length", High data access efficiency (on the basis of frequent changes)
- MyISAM Dynamic: Data column has no fixed length, storage efficiency is high; disadvantage: a large amount of data fragmentation is generated when deleting
- MyISAM compressed: Compress the MyISAM, take up less space; disadvantage: Data small becomes read-only data table, cannot modify
The evolution version of Innodb,myisam adds the functions of transaction, FOREIGN KEY constraint and so on. Disadvantage: I don't know if there are any more, after all, the times are developing
Summary: If the space and time requirements are high, the use of MyISAM, if you need transactions, foreign keys, data row-level locking mechanism, the use of InnoDB
HEAP (Temporary data table) {Hash index hash indexes, advantages: fast Access}
Heap restriction: Cannot use---TEXT 、---bolb, <, >, <=, >=, auto_increment; index NOT NULL only
The length of the HEAP data sheet in the book was not found in the config file, config_max_heap_table_size
The data column width (INT (4)) acts like the conversion specifier%4d in the C language, and Warning (can cause truncation of data when performing complex queries that need to be completed with the help of a temporary data table)
Auto_increment
- Only one a_t data column per table
- Select LAST_INSERT_ID ()
- If it grows to the maximum value, it will not continue to increment, and no more data will be inserted
- If you have a_t, you must have primary key
Bit&bool (binary)
Float&doule (REAL) floating point number
(m,d) m specifies the number of decimal digits, but only the display effect; d specifies the number of digits after the decimal point (which is rounded)
The inserted data will be rounded as necessary
Decimal (fixed number)
Use decimal If rounding will produce errors. Decimal is used to save data in the form of a string
DATE, Time, Datatime, year, Timetamp
Data type that represents a date
Timetamp, the time of the last modification is recorded when the data is modified
If you do not want to save the recording time for this modification, update tablename SET col=new value,ts=ts;
If you want to make a date layout, use Data_format ()
MySQL (1)