📄 strict.result
字号:
Warnings:Warning 1265 Data truncated for column 'col1' at row 1UPDATE IGNORE t1 SET col1 ='yellow' WHERE col1 ='blue';Warnings:Warning 1265 Data truncated for column 'col1' at row 2SELECT * FROM t1;col1redgreenDROP TABLE t1;CREATE TABLE t1 (col1 INT NOT NULL, col2 CHAR(5) NOT NULL, col3 DATE NOT NULL);INSERT INTO t1 VALUES (100, 'hello', '2004-08-20');INSERT INTO t1 (col1,col2,col3) VALUES (101, 'hell2', '2004-08-21');INSERT INTO t1 (col1,col2,col3) VALUES (NULL, '', '2004-01-01');ERROR 23000: Column 'col1' cannot be nullINSERT INTO t1 (col1,col2,col3) VALUES (102, NULL, '2004-01-01');ERROR 23000: Column 'col2' cannot be nullINSERT INTO t1 VALUES (103,'',NULL);ERROR 23000: Column 'col3' cannot be nullUPDATE t1 SET col1=NULL WHERE col1 =100;ERROR 22004: Column set to default value; NULL supplied to NOT NULL column 'col1' at row 1UPDATE t1 SET col2 =NULL WHERE col2 ='hello';ERROR 22004: Column set to default value; NULL supplied to NOT NULL column 'col2' at row 1UPDATE t1 SET col2 =NULL where col3 IS NOT NULL;ERROR 22004: Column set to default value; NULL supplied to NOT NULL column 'col2' at row 1INSERT IGNORE INTO t1 values (NULL,NULL,NULL);Warnings:Warning 1263 Column set to default value; NULL supplied to NOT NULL column 'col1' at row 1Warning 1263 Column set to default value; NULL supplied to NOT NULL column 'col2' at row 1Warning 1263 Column set to default value; NULL supplied to NOT NULL column 'col3' at row 1SELECT * FROM t1;col1 col2 col3100 hello 2004-08-20101 hell2 2004-08-210 0000-00-00DROP TABLE t1;CREATE TABLE t1 (col1 INT NOT NULL default 99, col2 CHAR(6) NOT NULL);SHOW CREATE TABLE t1;Table Create Tablet1 CREATE TABLE "t1" ( "col1" int(11) NOT NULL default '99', "col2" char(6) NOT NULL)INSERT INTO t1 VALUES (1, 'hello');INSERT INTO t1 (col2) VALUES ('hello2');INSERT INTO t1 (col2) VALUES (NULL);ERROR 23000: Column 'col2' cannot be nullINSERT INTO t1 (col1) VALUES (2);ERROR HY000: Field 'col2' doesn't have a default valueINSERT INTO t1 VALUES(default(col1),default(col2));ERROR HY000: Field 'col2' doesn't have a default valueINSERT INTO t1 (col1) SELECT 1;ERROR HY000: Field 'col2' doesn't have a default valueINSERT INTO t1 SELECT 1,NULL;ERROR 22004: Column set to default value; NULL supplied to NOT NULL column 'col2' at row 1INSERT IGNORE INTO t1 values (NULL,NULL);Warnings:Warning 1263 Column set to default value; NULL supplied to NOT NULL column 'col1' at row 1Warning 1263 Column set to default value; NULL supplied to NOT NULL column 'col2' at row 1INSERT IGNORE INTO t1 (col1) values (3);Warnings:Warning 1364 Field 'col2' doesn't have a default valueINSERT IGNORE INTO t1 () values ();Warnings:Warning 1364 Field 'col2' doesn't have a default valueSELECT * FROM t1;col1 col21 hello99 hello20 3 99 DROP TABLE t1;set sql_mode='traditional';create table t1 (charcol char(255), varcharcol varchar(255),binarycol binary(255), varbinarycol varbinary(255), tinytextcol tinytext,tinyblobcol tinyblob);insert into t1 (charcol) values (repeat('x',256));ERROR 22001: Data too long for column 'charcol' at row 1insert into t1 (varcharcol) values (repeat('x',256));ERROR 22001: Data too long for column 'varcharcol' at row 1insert into t1 (binarycol) values (repeat('x',256));ERROR 22001: Data too long for column 'binarycol' at row 1insert into t1 (varbinarycol) values (repeat('x',256));ERROR 22001: Data too long for column 'varbinarycol' at row 1insert into t1 (tinytextcol) values (repeat('x',256));ERROR 22001: Data too long for column 'tinytextcol' at row 1insert into t1 (tinyblobcol) values (repeat('x',256));ERROR 22001: Data too long for column 'tinyblobcol' at row 1select * from t1;charcol varcharcol binarycol varbinarycol tinytextcol tinyblobcoldrop table t1;set sql_mode='traditional';create table t1 (col1 datetime);insert into t1 values(STR_TO_DATE('31.10.2004 15.30 abc','%d.%m.%Y %H.%i'));ERROR 22007: Truncated incorrect datetime value: '31.10.2004 15.30 abc'insert into t1 values(STR_TO_DATE('32.10.2004 15.30','%d.%m.%Y %H.%i'));ERROR HY000: Incorrect datetime value: '32.10.2004 15.30' for function str_to_timeinsert into t1 values(STR_TO_DATE('2004.12.12 22:22:33 AM','%Y.%m.%d %r'));ERROR HY000: Incorrect time value: '22:22:33 AM' for function str_to_timeinsert into t1 values(STR_TO_DATE('2004.12.12 abc','%Y.%m.%d %T'));ERROR HY000: Incorrect time value: 'abc' for function str_to_timeset sql_mode='';insert into t1 values(STR_TO_DATE('31.10.2004 15.30 abc','%d.%m.%Y %H.%i'));Warnings:Warning 1292 Truncated incorrect datetime value: '31.10.2004 15.30 abc'insert into t1 values(STR_TO_DATE('32.10.2004 15.30','%d.%m.%Y %H.%i'));Warnings:Error 1411 Incorrect datetime value: '32.10.2004 15.30' for function str_to_timeinsert into t1 values(STR_TO_DATE('2004.12.12 22:22:33 AM','%Y.%m.%d %r'));Warnings:Error 1411 Incorrect time value: '22:22:33 AM' for function str_to_timeinsert into t1 values(STR_TO_DATE('2004.12.12 abc','%Y.%m.%d %T'));Warnings:Error 1411 Incorrect time value: 'abc' for function str_to_timeinsert into t1 values(STR_TO_DATE('31.10.2004 15.30','%d.%m.%Y %H.%i'));insert into t1 values(STR_TO_DATE('2004.12.12 11:22:33 AM','%Y.%m.%d %r'));insert into t1 values(STR_TO_DATE('2004.12.12 10:22:59','%Y.%m.%d %T'));select * from t1;col12004-10-31 15:30:00NULLNULLNULL2004-10-31 15:30:002004-12-12 11:22:332004-12-12 10:22:59set sql_mode='traditional';select count(*) from t1 where STR_TO_DATE('2004.12.12 10:22:61','%Y.%m.%d %T') IS NULL;count(*)7Warnings:Error 1411 Incorrect datetime value: '2004.12.12 10:22:61' for function str_to_timeError 1411 Incorrect datetime value: '2004.12.12 10:22:61' for function str_to_timeError 1411 Incorrect datetime value: '2004.12.12 10:22:61' for function str_to_timedrop table t1;create table t1 (col1 char(3), col2 integer);insert into t1 (col1) values (cast(1000 as char(3)));ERROR 22007: Truncated incorrect CHAR(3) value: '1000'insert into t1 (col1) values (cast(1000E+0 as char(3)));ERROR 22007: Truncated incorrect CHAR(3) value: '1000'insert into t1 (col1) values (cast(1000.0 as char(3)));ERROR 22007: Truncated incorrect CHAR(3) value: '1000.0'insert into t1 (col2) values (cast('abc' as signed integer));ERROR 22007: Truncated incorrect INTEGER value: 'abc'insert into t1 (col2) values (10E+0 + 'a');ERROR 22007: Truncated incorrect DOUBLE value: 'a'insert into t1 (col2) values (cast('10a' as unsigned integer));ERROR 22007: Truncated incorrect INTEGER value: '10a'insert into t1 (col2) values (cast('10' as unsigned integer));insert into t1 (col2) values (cast('10' as signed integer));insert into t1 (col2) values (10E+0 + '0 ');select * from t1;col1 col2NULL 10NULL 10NULL 10drop table t1;create table t1 (col1 date, col2 datetime, col3 timestamp);insert into t1 values (0,0,0);ERROR 22007: Incorrect date value: '0' for column 'col1' at row 1insert into t1 values (0.0,0.0,0.0);ERROR 22007: Incorrect date value: '0' for column 'col1' at row 1insert into t1 (col1) values (convert('0000-00-00',date));ERROR 22007: Truncated incorrect datetime value: '0000-00-00'insert into t1 (col1) values (cast('0000-00-00' as date));ERROR 22007: Truncated incorrect datetime value: '0000-00-00'set sql_mode='no_zero_date';insert into t1 values (0,0,0);Warnings:Warning 1264 Out of range value adjusted for column 'col1' at row 1Warning 1264 Out of range value adjusted for column 'col2' at row 1Warning 1265 Data truncated for column 'col3' at row 1insert into t1 values (0.0,0.0,0.0);Warnings:Warning 1264 Out of range value adjusted for column 'col1' at row 1Warning 1264 Out of range value adjusted for column 'col2' at row 1Warning 1265 Data truncated for column 'col3' at row 1drop table t1;set sql_mode='traditional';create table t1 (col1 date);insert ignore into t1 values ('0000-00-00');Warnings:Warning 1265 Data truncated for column 'col1' at row 1insert into t1 select * from t1;ERROR 22007: Incorrect date value: '0000-00-00' for column 'col1' at row 1insert ignore into t1 values ('0000-00-00');Warnings:Warning 1265 Data truncated for column 'col1' at row 1insert ignore into t1 (col1) values (cast('0000-00-00' as date));Warnings:Warning 1292 Truncated incorrect datetime value: '0000-00-00'insert into t1 select * from t1;ERROR 22007: Incorrect date value: '0000-00-00' for column 'col1' at row 1alter table t1 modify col1 datetime;ERROR 22007: Incorrect datetime value: '0000-00-00' for column 'col1' at row 1alter ignore table t1 modify col1 datetime;Warnings:Warning 1264 Out of range value adjusted for column 'col1' at row 1Warning 1264 Out of range value adjusted for column 'col1' at row 2insert into t1 select * from t1;ERROR 22007: Incorrect datetime value: '0000-00-00 00:00:00' for column 'col1' at row 1select * from t1;col10000-00-00 00:00:000000-00-00 00:00:00NULLdrop table t1;create table t1 (col1 tinyint);drop procedure if exists t1;Warnings:Note 1305 PROCEDURE t1 does not existcreate procedure t1 () begin declare exit handler for sqlexceptionselect'a'; insert into t1 values (200); end;|call t1();aaselect * from t1;col1drop procedure t1;drop table t1;set sql_mode=@org_mode;SET @@sql_mode = 'traditional';CREATE TABLE t1 (i int not null);INSERT INTO t1 VALUES ();ERROR HY000: Field 'i' doesn't have a default valueINSERT INTO t1 VALUES (DEFAULT);ERROR HY000: Field 'i' doesn't have a default valueINSERT INTO t1 VALUES (DEFAULT(i));ERROR HY000: Field 'i' doesn't have a default valueALTER TABLE t1 ADD j int;INSERT INTO t1 SET j = 1;ERROR HY000: Field 'i' doesn't have a default valueINSERT INTO t1 SET j = 1, i = DEFAULT;ERROR HY000: Field 'i' doesn't have a default valueINSERT INTO t1 SET j = 1, i = DEFAULT(i);ERROR HY000: Field 'i' doesn't have a default valueINSERT INTO t1 VALUES (DEFAULT,1);ERROR HY000: Field 'i' doesn't have a default valueDROP TABLE t1;SET @@sql_mode = '';CREATE TABLE t1 (i int not null);INSERT INTO t1 VALUES ();Warnings:Warning 1364 Field 'i' doesn't have a default valueINSERT INTO t1 VALUES (DEFAULT);Warnings:Warning 1364 Field 'i' doesn't have a default valueINSERT INTO t1 VALUES (DEFAULT(i));ERROR HY000: Field 'i' doesn't have a default valueALTER TABLE t1 ADD j int;INSERT INTO t1 SET j = 1;Warnings:Warning 1364 Field 'i' doesn't have a default valueINSERT INTO t1 SET j = 1, i = DEFAULT;Warnings:Warning 1364 Field 'i' doesn't have a default valueINSERT INTO t1 SET j = 1, i = DEFAULT(i);ERROR HY000: Field 'i' doesn't have a default valueINSERT INTO t1 VALUES (DEFAULT,1);Warnings:Warning 1364 Field 'i' doesn't have a default valueDROP TABLE t1;set @@sql_mode='traditional';create table t1(a varchar(65537));ERROR 42000: Column length too big for column 'a' (max = 65535); use BLOB or TEXT insteadcreate table t1(a varbinary(65537));ERROR 42000: Column length too big for column 'a' (max = 65535); use BLOB or TEXT insteadset @@sql_mode='traditional';create table t1(a int, b date not null);alter table t1 modify a bigint unsigned not null;show create table t1;Table Create Tablet1 CREATE TABLE `t1` ( `a` bigint(20) unsigned NOT NULL, `b` date NOT NULL) ENGINE=MyISAM DEFAULT CHARSET=latin1drop table t1;set @@sql_mode='traditional';create table t1 (d date);insert into t1 values ('2000-10-00');ERROR 22007: Incorrect date value: '2000-10-00' for column 'd' at row 1insert into t1 values (1000);ERROR 22007: Incorrect date value: '1000' for column 'd' at row 1insert into t1 values ('2000-10-01');update t1 set d = 1100;ERROR 22007: Incorrect date value: '1100' for column 'd' at row 1select * from t1;d2000-10-01drop table t1;set @@sql_mode='traditional';create table t1(a int, b timestamp);alter table t1 add primary key(a);show create table t1;Table Create Tablet1 CREATE TABLE `t1` ( `a` int(11) NOT NULL default '0', `b` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP, PRIMARY KEY (`a`)) ENGINE=MyISAM DEFAULT CHARSET=latin1drop table t1;create table t1(a int, b timestamp default 20050102030405);alter table t1 add primary key(a);show create table t1;Table Create Tablet1 CREATE TABLE `t1` ( `a` int(11) NOT NULL default '0', `b` timestamp NOT NULL default '2005-01-02 03:04:05', PRIMARY KEY (`a`)) ENGINE=MyISAM DEFAULT CHARSET=latin1drop table t1;set @@sql_mode='traditional';create table t1(a bit(2));insert into t1 values(b'101');ERROR 22001: Data too long for column 'a' at row 1select * from t1;adrop table t1;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -