1drop table if exists t1,t2; 2create table t1(str varchar(10) default 'def',strnull varchar(10),intg int default '10',rel double default '3.14'); 3insert into t1 values ('','',0,0.0); 4select default(str), default(strnull), default(intg), default(rel) from t1; 5default(str) default(strnull) default(intg) default(rel) 6def NULL 10 3.14 7explain extended select default(str), default(strnull), default(intg), default(rel) from t1; 8id select_type table partitions type possible_keys key key_len ref rows filtered Extra 91 SIMPLE t1 NULL system NULL NULL NULL NULL 1 100.00 NULL 10Warnings: 11Warning 1681 'EXTENDED' is deprecated and will be removed in a future release. 12Note 1003 /* select#1 */ select default('') AS `default(str)`,default('') AS `default(strnull)`,default('0') AS `default(intg)`,default('0') AS `default(rel)` from dual 13select * from t1 where str <> default(str); 14str strnull intg rel 15 0 0 16explain select * from t1 where str <> default(str); 17id select_type table partitions type possible_keys key key_len ref rows filtered Extra 181 SIMPLE t1 NULL system NULL NULL NULL NULL 1 100.00 NULL 19Warnings: 20Note 1003 /* select#1 */ select '' AS `str`,'' AS `strnull`,'0' AS `intg`,'0' AS `rel` from dual where ('' <> default('')) 21drop table t1; 22CREATE TABLE t1 (id int(11), s varchar(20)); 23INSERT INTO t1 VALUES (1, 'one'), (2, 'two'), (3, 'three'); 24SELECT s, 32 AS mi FROM t1 GROUP BY s HAVING DEFAULT(mi) IS NULL; 25ERROR HY000: Field 'mi' doesn't have a default value 26DROP TABLE t1; 27