再次,这是QN从MySQL认证指导书的做法QNS ...MySQL的插入无效日期
问题
Here's the structure of a table typetest with three columns (number, string, and dates). As- sume the server is running in MySQL's “forgiving” SQL mode. mysql> DESCRIBE typetest; +--------+---------------------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +--------+---------------------+------+-----+---------+-------+ | number | tinyint(3) unsigned | YES | | NULL | | +--------+---------------------+------+-----+---------+-------+ You perform the following INSERT operation on table typetest: INSERT INTO typetest VALUES (1000,'yoodoo','999-12-31'); What data values will actually be stored in the table? Provide a short explanation.
ANSWER
+--------+--------+------------+ | number | string | dates | +--------+--------+------------+ | 255 | yoodo | 0000-00-00 | +--------+--------+------------+ The inserted number 1000 is too big to fit in the TINYINT UNSIGNED column, so the highest pos- sible value (255) is inserted. 'yoodoo' is too long for a CHAR(5) column and is thus truncated to five characters. '999-12-31' is a date that is earlier than the earliest possible DATE value ('1000-01-01'). This is interpreted as an invalid date, so the “zero” date is stored.
时我尝试将'999-12-31'插入到我获得0999-12-31的日期中。我阅读了认证指南中的一些地方,mysql可能会将日期从1000-01-01范围内插入到9999-12-31。但是在考试中我回答了什么?