How MySQL deals with incorrect date value : Date « Data Type « SQL / MySQL






How MySQL deals with incorrect date value

    
mysql>
mysql> CREATE TABLE INCORRECT_DATES (COLUMN1 DATE);
Query OK, 0 rows affected (0.00 sec)

mysql>
mysql> INSERT INTO INCORRECT_DATES VALUES ('2004-13-12');
Query OK, 1 row affected, 1 warning (0.00 sec)

mysql>
mysql> SELECT COLUMN1 FROM INCORRECT_DATES;
+------------+
| COLUMN1    |
+------------+
| 0000-00-00 |
+------------+
1 row in set (0.00 sec)

mysql>
mysql> CREATE TABLE TIME_TABLE (COLUMN1 TIME);
mysql>
mysql> INSERT INTO TIME_TABLE VALUES ('23:59:59.5912');
Query OK, 1 row affected (0.00 sec)

mysql>
mysql> SELECT COLUMN1 FROM TIME_TABLE;
+----------+
| COLUMN1  |
+----------+
| 23:59:59 |
| 23:59:59 |
| 23:59:59 |
| 23:59:59 |
+----------+
4 rows in set (0.00 sec)

mysql>
mysql> drop table INCORRECT_DATES;
Query OK, 0 rows affected (0.00 sec)

mysql>

   
    
    
    
  








Related examples in the same category

1.Date type value in the form '2003-12-31', range 1000-01-01 to 9999-12-31 (3 bytes)
2.To find the row with the most recent birth date, the query is similar, except that you sort in descending orde
3.Compare with Date value
4.Date literal in where clause
5.Date value literal
6.Date type value inside in operator and subquery
7.Date calculation with variable
8.Date default value
9.Sorting by Calendar Day