Warning 1292 Incorrect interval value: '42949672965959.123456000' for column 'b' at row 3
Warning 1292 Incorrect interval value: '42949672965959.123456000' for column 'b' at row 3
Warning 1292 Incorrect interval value: '42949672965959.123456000' for column 'b' at row 3
Warning 1292 Incorrect interval value: '42949672965959.123456000' for column 'b' at row 3
Warning 1292 Incorrect interval value: '42949672965959.123456000' for column 'b' at row 3
Warning 1292 Incorrect interval value: '42949672965959.123456000' for column 'b' at row 3
Warning 1292 Incorrect interval value: '42949672965959.123456000' for column 'b' at row 3
Warning 1292 Incorrect interval value: '42949672965959.123456000' for column 'b' at row 3
Warning 1292 Incorrect interval value: '42949672955959.123456000' for column 'b' at row 4
Warning 1292 Incorrect interval value: '42949672955959.123456000' for column 'b' at row 4
Warning 1292 Incorrect interval value: '42949672955959.123456000' for column 'b' at row 4
Warning 1292 Incorrect interval value: '42949672955959.123456000' for column 'b' at row 4
Warning 1292 Incorrect interval value: '42949672955959.123456000' for column 'b' at row 4
Warning 1292 Incorrect interval value: '42949672955959.123456000' for column 'b' at row 4
Warning 1292 Incorrect interval value: '42949672955959.123456000' for column 'b' at row 4
Warning 1292 Incorrect interval value: '42949672955959.123456000' for column 'b' at row 4
Warning 1292 Incorrect interval value: '876494165959.123456000' for column 'b' at row 5
Warning 1292 Incorrect interval value: '876494165959.123456000' for column 'b' at row 5
Warning 1292 Incorrect interval value: '876494165959.123456000' for column 'b' at row 5
Warning 1292 Incorrect interval value: '876494165959.123456000' for column 'b' at row 5
Warning 1292 Incorrect interval value: '876494165959.123456000' for column 'b' at row 5
Warning 1292 Incorrect interval value: '876494165959.123456000' for column 'b' at row 5
Warning 1292 Incorrect interval value: '876494165959.123456000' for column 'b' at row 5
Warning 1292 Incorrect interval value: '876494165959.123456000' for column 'b' at row 5
DROP TABLE t1;
# Special case: DAY + TIME
CREATE TABLE t1 (a VARCHAR(64));
INSERT INTO t1 VALUES ('9999-01-01');
SELECT a,
EXTRACT(DAY_HOUR FROM a),
EXTRACT(DAY_MINUTE FROM a),
EXTRACT(DAY_SECOND FROM a),
EXTRACT(DAY_MICROSECOND FROM a),
EXTRACT(DAY FROM a),
EXTRACT(HOUR FROM a),
EXTRACT(MINUTE FROM a),
EXTRACT(SECOND FROM a),
EXTRACT(MICROSECOND FROM a)
FROM t1;
a EXTRACT(DAY_HOUR FROM a) EXTRACT(DAY_MINUTE FROM a) EXTRACT(DAY_SECOND FROM a) EXTRACT(DAY_MICROSECOND FROM a) EXTRACT(DAY FROM a) EXTRACT(HOUR FROM a) EXTRACT(MINUTE FROM a) EXTRACT(SECOND FROM a) EXTRACT(MICROSECOND FROM a)
a EXTRACT(DAY_HOUR FROM a) EXTRACT(DAY_MINUTE FROM a) EXTRACT(DAY_SECOND FROM a) EXTRACT(DAY_MICROSECOND FROM a) EXTRACT(DAY FROM a) EXTRACT(HOUR FROM a) EXTRACT(MINUTE FROM a) EXTRACT(SECOND FROM a) EXTRACT(MICROSECOND FROM a)
NULL NULL NULL NULL NULL NULL NULL NULL NULL
Warnings:
Warning 1292 Incorrect interval value: ''
Warning 1292 Incorrect interval value: ''
Warning 1292 Incorrect interval value: ''
Warning 1292 Incorrect interval value: ''
Warning 1292 Incorrect interval value: ''
Warning 1292 Incorrect interval value: ''
Warning 1292 Incorrect interval value: ''
Warning 1292 Incorrect interval value: ''
Warning 1292 Incorrect interval value: ''
DROP TABLE t1;
# Backward compatibility
# This still parses as DATETIME
SELECT EXTRACT(YEAR FROM '2001/02/03 10:20:30');
EXTRACT(YEAR FROM '2001/02/03 10:20:30')
2001
SELECT EXTRACT(MONTH FROM '2001/02/03 10:20:30');
EXTRACT(MONTH FROM '2001/02/03 10:20:30')
2
SELECT EXTRACT(DAY FROM '2001/02/03 10:20:30');
EXTRACT(DAY FROM '2001/02/03 10:20:30')
3
SELECT EXTRACT(YEAR FROM '01/02/03 10:20:30');
EXTRACT(YEAR FROM '01/02/03 10:20:30')
2001
SELECT EXTRACT(MONTH FROM '01/02/03 10:20:30');
EXTRACT(MONTH FROM '01/02/03 10:20:30')
2
SELECT EXTRACT(DAY FROM '01/02/03 10:20:30');
EXTRACT(DAY FROM '01/02/03 10:20:30')
3
SELECT EXTRACT(YEAR FROM '01:02:03 10:20:30');
EXTRACT(YEAR FROM '01:02:03 10:20:30')
2001
SELECT EXTRACT(MONTH FROM '01:02:03 10:20:30');
EXTRACT(MONTH FROM '01:02:03 10:20:30')
2
SELECT EXTRACT(DAY FROM '01:02:03 10:20:30');
EXTRACT(DAY FROM '01:02:03 10:20:30')
3
# This still parses as DATETIME and returns NULL
SELECT EXTRACT(YEAR FROM "2011-02-32 8:46:06.23434");