polardbxengine/mysql-test/suite/engines/funcs/r/ta_set_drop_default.result

906 lines
23 KiB
Plaintext

DROP TABLE IF EXISTS t1;
SET sql_mode='NO_ENGINE_SUBSTITUTION';
CREATE TABLE t1(c1 TINYINT NOT NULL PRIMARY KEY, c2 TINYINT);
SHOW TABLES;
Tables_in_test
t1
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`c1` tinyint(4) NOT NULL,
`c2` tinyint(4) DEFAULT NULL,
PRIMARY KEY (`c1`)
) ENGINE=ENGINE DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci
ALTER TABLE t1 ALTER c2 SET DEFAULT 10;
INSERT INTO t1(c1) VALUES(1);
SELECT * FROM t1 ORDER BY c1;
c1 c2
1 10
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`c1` tinyint(4) NOT NULL,
`c2` tinyint(4) DEFAULT '10',
PRIMARY KEY (`c1`)
) ENGINE=ENGINE DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci
ALTER TABLE t1 ALTER c2 DROP DEFAULT;
INSERT INTO t1(c1) VALUES(2);
Warnings:
Warning 1364 Field 'c2' doesn't have a default value
SELECT * FROM t1 ORDER BY c1;
c1 c2
1 10
2 NULL
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`c1` tinyint(4) NOT NULL,
`c2` tinyint(4),
PRIMARY KEY (`c1`)
) ENGINE=ENGINE DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci
DROP TABLE t1;
SHOW TABLES;
Tables_in_test
CREATE TABLE t1(c1 SMALLINT NOT NULL PRIMARY KEY, c2 SMALLINT);
SHOW TABLES;
Tables_in_test
t1
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`c1` smallint(6) NOT NULL,
`c2` smallint(6) DEFAULT NULL,
PRIMARY KEY (`c1`)
) ENGINE=ENGINE DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci
ALTER TABLE t1 ALTER c2 SET DEFAULT 10;
INSERT INTO t1(c1) VALUES(1);
SELECT * FROM t1 ORDER BY c1;
c1 c2
1 10
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`c1` smallint(6) NOT NULL,
`c2` smallint(6) DEFAULT '10',
PRIMARY KEY (`c1`)
) ENGINE=ENGINE DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci
ALTER TABLE t1 ALTER c2 DROP DEFAULT;
INSERT INTO t1(c1) VALUES(2);
Warnings:
Warning 1364 Field 'c2' doesn't have a default value
SELECT * FROM t1 ORDER BY c1;
c1 c2
1 10
2 NULL
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`c1` smallint(6) NOT NULL,
`c2` smallint(6),
PRIMARY KEY (`c1`)
) ENGINE=ENGINE DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci
DROP TABLE t1;
SHOW TABLES;
Tables_in_test
CREATE TABLE t1(c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 MEDIUMINT);
SHOW TABLES;
Tables_in_test
t1
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`c1` mediumint(9) NOT NULL,
`c2` mediumint(9) DEFAULT NULL,
PRIMARY KEY (`c1`)
) ENGINE=ENGINE DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci
ALTER TABLE t1 ALTER c2 SET DEFAULT 10;
INSERT INTO t1(c1) VALUES(1);
SELECT * FROM t1 ORDER BY c1;
c1 c2
1 10
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`c1` mediumint(9) NOT NULL,
`c2` mediumint(9) DEFAULT '10',
PRIMARY KEY (`c1`)
) ENGINE=ENGINE DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci
ALTER TABLE t1 ALTER c2 DROP DEFAULT;
INSERT INTO t1(c1) VALUES(2);
Warnings:
Warning 1364 Field 'c2' doesn't have a default value
SELECT * FROM t1 ORDER BY c1;
c1 c2
1 10
2 NULL
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`c1` mediumint(9) NOT NULL,
`c2` mediumint(9),
PRIMARY KEY (`c1`)
) ENGINE=ENGINE DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci
DROP TABLE t1;
SHOW TABLES;
Tables_in_test
CREATE TABLE t1(c1 INT NOT NULL PRIMARY KEY, c2 INT);
SHOW TABLES;
Tables_in_test
t1
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`c1` int(11) NOT NULL,
`c2` int(11) DEFAULT NULL,
PRIMARY KEY (`c1`)
) ENGINE=ENGINE DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci
ALTER TABLE t1 ALTER c2 SET DEFAULT 10;
INSERT INTO t1(c1) VALUES(1);
SELECT * FROM t1 ORDER BY c1;
c1 c2
1 10
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`c1` int(11) NOT NULL,
`c2` int(11) DEFAULT '10',
PRIMARY KEY (`c1`)
) ENGINE=ENGINE DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci
ALTER TABLE t1 ALTER c2 DROP DEFAULT;
INSERT INTO t1(c1) VALUES(2);
Warnings:
Warning 1364 Field 'c2' doesn't have a default value
SELECT * FROM t1 ORDER BY c1;
c1 c2
1 10
2 NULL
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`c1` int(11) NOT NULL,
`c2` int(11),
PRIMARY KEY (`c1`)
) ENGINE=ENGINE DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci
DROP TABLE t1;
SHOW TABLES;
Tables_in_test
CREATE TABLE t1(c1 INTEGER NOT NULL PRIMARY KEY, c2 INTEGER);
SHOW TABLES;
Tables_in_test
t1
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`c1` int(11) NOT NULL,
`c2` int(11) DEFAULT NULL,
PRIMARY KEY (`c1`)
) ENGINE=ENGINE DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci
ALTER TABLE t1 ALTER c2 SET DEFAULT 10;
INSERT INTO t1(c1) VALUES(1);
SELECT * FROM t1 ORDER BY c1;
c1 c2
1 10
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`c1` int(11) NOT NULL,
`c2` int(11) DEFAULT '10',
PRIMARY KEY (`c1`)
) ENGINE=ENGINE DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci
ALTER TABLE t1 ALTER c2 DROP DEFAULT;
INSERT INTO t1(c1) VALUES(2);
Warnings:
Warning 1364 Field 'c2' doesn't have a default value
SELECT * FROM t1 ORDER BY c1;
c1 c2
1 10
2 NULL
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`c1` int(11) NOT NULL,
`c2` int(11),
PRIMARY KEY (`c1`)
) ENGINE=ENGINE DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci
DROP TABLE t1;
SHOW TABLES;
Tables_in_test
CREATE TABLE t1(c1 BIGINT NOT NULL PRIMARY KEY, c2 BIGINT);
SHOW TABLES;
Tables_in_test
t1
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`c1` bigint(20) NOT NULL,
`c2` bigint(20) DEFAULT NULL,
PRIMARY KEY (`c1`)
) ENGINE=ENGINE DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci
ALTER TABLE t1 ALTER c2 SET DEFAULT 10;
INSERT INTO t1(c1) VALUES(1);
SELECT * FROM t1 ORDER BY c1;
c1 c2
1 10
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`c1` bigint(20) NOT NULL,
`c2` bigint(20) DEFAULT '10',
PRIMARY KEY (`c1`)
) ENGINE=ENGINE DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci
ALTER TABLE t1 ALTER c2 DROP DEFAULT;
INSERT INTO t1(c1) VALUES(2);
Warnings:
Warning 1364 Field 'c2' doesn't have a default value
SELECT * FROM t1 ORDER BY c1;
c1 c2
1 10
2 NULL
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`c1` bigint(20) NOT NULL,
`c2` bigint(20),
PRIMARY KEY (`c1`)
) ENGINE=ENGINE DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci
DROP TABLE t1;
SHOW TABLES;
Tables_in_test
CREATE TABLE t1(c1 REAL NOT NULL PRIMARY KEY, c2 REAL);
SHOW TABLES;
Tables_in_test
t1
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`c1` double NOT NULL,
`c2` double DEFAULT NULL,
PRIMARY KEY (`c1`)
) ENGINE=ENGINE DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci
ALTER TABLE t1 ALTER c2 SET DEFAULT 10;
INSERT INTO t1(c1) VALUES(1);
SELECT * FROM t1 ORDER BY c1;
c1 c2
1 10
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`c1` double NOT NULL,
`c2` double DEFAULT '10',
PRIMARY KEY (`c1`)
) ENGINE=ENGINE DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci
ALTER TABLE t1 ALTER c2 DROP DEFAULT;
INSERT INTO t1(c1) VALUES(2);
Warnings:
Warning 1364 Field 'c2' doesn't have a default value
SELECT * FROM t1 ORDER BY c1;
c1 c2
1 10
2 NULL
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`c1` double NOT NULL,
`c2` double,
PRIMARY KEY (`c1`)
) ENGINE=ENGINE DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci
DROP TABLE t1;
SHOW TABLES;
Tables_in_test
CREATE TABLE t1(c1 DOUBLE NOT NULL PRIMARY KEY, c2 DOUBLE);
SHOW TABLES;
Tables_in_test
t1
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`c1` double NOT NULL,
`c2` double DEFAULT NULL,
PRIMARY KEY (`c1`)
) ENGINE=ENGINE DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci
ALTER TABLE t1 ALTER c2 SET DEFAULT 10;
INSERT INTO t1(c1) VALUES(1);
SELECT * FROM t1 ORDER BY c1;
c1 c2
1 10
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`c1` double NOT NULL,
`c2` double DEFAULT '10',
PRIMARY KEY (`c1`)
) ENGINE=ENGINE DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci
ALTER TABLE t1 ALTER c2 DROP DEFAULT;
INSERT INTO t1(c1) VALUES(2);
Warnings:
Warning 1364 Field 'c2' doesn't have a default value
SELECT * FROM t1 ORDER BY c1;
c1 c2
1 10
2 NULL
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`c1` double NOT NULL,
`c2` double,
PRIMARY KEY (`c1`)
) ENGINE=ENGINE DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci
DROP TABLE t1;
SHOW TABLES;
Tables_in_test
CREATE TABLE t1(c1 FLOAT NOT NULL PRIMARY KEY, c2 FLOAT);
SHOW TABLES;
Tables_in_test
t1
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`c1` float NOT NULL,
`c2` float DEFAULT NULL,
PRIMARY KEY (`c1`)
) ENGINE=ENGINE DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci
ALTER TABLE t1 ALTER c2 SET DEFAULT 10;
INSERT INTO t1(c1) VALUES(1);
SELECT * FROM t1 ORDER BY c1;
c1 c2
1 10
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`c1` float NOT NULL,
`c2` float DEFAULT '10',
PRIMARY KEY (`c1`)
) ENGINE=ENGINE DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci
ALTER TABLE t1 ALTER c2 DROP DEFAULT;
INSERT INTO t1(c1) VALUES(2);
Warnings:
Warning 1364 Field 'c2' doesn't have a default value
SELECT * FROM t1 ORDER BY c1;
c1 c2
1 10
2 NULL
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`c1` float NOT NULL,
`c2` float,
PRIMARY KEY (`c1`)
) ENGINE=ENGINE DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci
DROP TABLE t1;
SHOW TABLES;
Tables_in_test
CREATE TABLE t1(c1 DECIMAL NOT NULL PRIMARY KEY, c2 DECIMAL);
SHOW TABLES;
Tables_in_test
t1
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`c1` decimal(10,0) NOT NULL,
`c2` decimal(10,0) DEFAULT NULL,
PRIMARY KEY (`c1`)
) ENGINE=ENGINE DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci
ALTER TABLE t1 ALTER c2 SET DEFAULT 10;
INSERT INTO t1(c1) VALUES(1);
SELECT * FROM t1 ORDER BY c1;
c1 c2
1 10
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`c1` decimal(10,0) NOT NULL,
`c2` decimal(10,0) DEFAULT '10',
PRIMARY KEY (`c1`)
) ENGINE=ENGINE DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci
ALTER TABLE t1 ALTER c2 DROP DEFAULT;
INSERT INTO t1(c1) VALUES(2);
Warnings:
Warning 1364 Field 'c2' doesn't have a default value
SELECT * FROM t1 ORDER BY c1;
c1 c2
1 10
2 NULL
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`c1` decimal(10,0) NOT NULL,
`c2` decimal(10,0),
PRIMARY KEY (`c1`)
) ENGINE=ENGINE DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci
DROP TABLE t1;
SHOW TABLES;
Tables_in_test
CREATE TABLE t1(c1 NUMERIC NOT NULL PRIMARY KEY, c2 NUMERIC);
SHOW TABLES;
Tables_in_test
t1
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`c1` decimal(10,0) NOT NULL,
`c2` decimal(10,0) DEFAULT NULL,
PRIMARY KEY (`c1`)
) ENGINE=ENGINE DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci
ALTER TABLE t1 ALTER c2 SET DEFAULT 10;
INSERT INTO t1(c1) VALUES(1);
SELECT * FROM t1 ORDER BY c1;
c1 c2
1 10
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`c1` decimal(10,0) NOT NULL,
`c2` decimal(10,0) DEFAULT '10',
PRIMARY KEY (`c1`)
) ENGINE=ENGINE DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci
ALTER TABLE t1 ALTER c2 DROP DEFAULT;
INSERT INTO t1(c1) VALUES(2);
Warnings:
Warning 1364 Field 'c2' doesn't have a default value
SELECT * FROM t1 ORDER BY c1;
c1 c2
1 10
2 NULL
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`c1` decimal(10,0) NOT NULL,
`c2` decimal(10,0),
PRIMARY KEY (`c1`)
) ENGINE=ENGINE DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci
DROP TABLE t1;
SHOW TABLES;
Tables_in_test
CREATE TABLE t1(c1 TINYINT NOT NULL PRIMARY KEY, c2 TINYINT);
SHOW TABLES;
Tables_in_test
t1
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`c1` tinyint(4) NOT NULL,
`c2` tinyint(4) DEFAULT NULL,
PRIMARY KEY (`c1`)
) ENGINE=ENGINE DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci
ALTER TABLE t1 ALTER COLUMN c2 SET DEFAULT 10;
INSERT INTO t1(c1) VALUES(1);
SELECT * FROM t1 ORDER BY c1;
c1 c2
1 10
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`c1` tinyint(4) NOT NULL,
`c2` tinyint(4) DEFAULT '10',
PRIMARY KEY (`c1`)
) ENGINE=ENGINE DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci
ALTER TABLE t1 ALTER COLUMN c2 DROP DEFAULT;
INSERT INTO t1(c1) VALUES(2);
Warnings:
Warning 1364 Field 'c2' doesn't have a default value
SELECT * FROM t1 ORDER BY c1;
c1 c2
1 10
2 NULL
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`c1` tinyint(4) NOT NULL,
`c2` tinyint(4),
PRIMARY KEY (`c1`)
) ENGINE=ENGINE DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci
DROP TABLE t1;
SHOW TABLES;
Tables_in_test
CREATE TABLE t1(c1 SMALLINT NOT NULL PRIMARY KEY, c2 SMALLINT);
SHOW TABLES;
Tables_in_test
t1
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`c1` smallint(6) NOT NULL,
`c2` smallint(6) DEFAULT NULL,
PRIMARY KEY (`c1`)
) ENGINE=ENGINE DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci
ALTER TABLE t1 ALTER COLUMN c2 SET DEFAULT 10;
INSERT INTO t1(c1) VALUES(1);
SELECT * FROM t1 ORDER BY c1;
c1 c2
1 10
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`c1` smallint(6) NOT NULL,
`c2` smallint(6) DEFAULT '10',
PRIMARY KEY (`c1`)
) ENGINE=ENGINE DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci
ALTER TABLE t1 ALTER COLUMN c2 DROP DEFAULT;
INSERT INTO t1(c1) VALUES(2);
Warnings:
Warning 1364 Field 'c2' doesn't have a default value
SELECT * FROM t1 ORDER BY c1;
c1 c2
1 10
2 NULL
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`c1` smallint(6) NOT NULL,
`c2` smallint(6),
PRIMARY KEY (`c1`)
) ENGINE=ENGINE DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci
DROP TABLE t1;
SHOW TABLES;
Tables_in_test
CREATE TABLE t1(c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 MEDIUMINT);
SHOW TABLES;
Tables_in_test
t1
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`c1` mediumint(9) NOT NULL,
`c2` mediumint(9) DEFAULT NULL,
PRIMARY KEY (`c1`)
) ENGINE=ENGINE DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci
ALTER TABLE t1 ALTER COLUMN c2 SET DEFAULT 10;
INSERT INTO t1(c1) VALUES(1);
SELECT * FROM t1 ORDER BY c1;
c1 c2
1 10
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`c1` mediumint(9) NOT NULL,
`c2` mediumint(9) DEFAULT '10',
PRIMARY KEY (`c1`)
) ENGINE=ENGINE DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci
ALTER TABLE t1 ALTER COLUMN c2 DROP DEFAULT;
INSERT INTO t1(c1) VALUES(2);
Warnings:
Warning 1364 Field 'c2' doesn't have a default value
SELECT * FROM t1 ORDER BY c1;
c1 c2
1 10
2 NULL
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`c1` mediumint(9) NOT NULL,
`c2` mediumint(9),
PRIMARY KEY (`c1`)
) ENGINE=ENGINE DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci
DROP TABLE t1;
SHOW TABLES;
Tables_in_test
CREATE TABLE t1(c1 INT NOT NULL PRIMARY KEY, c2 INT);
SHOW TABLES;
Tables_in_test
t1
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`c1` int(11) NOT NULL,
`c2` int(11) DEFAULT NULL,
PRIMARY KEY (`c1`)
) ENGINE=ENGINE DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci
ALTER TABLE t1 ALTER COLUMN c2 SET DEFAULT 10;
INSERT INTO t1(c1) VALUES(1);
SELECT * FROM t1 ORDER BY c1;
c1 c2
1 10
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`c1` int(11) NOT NULL,
`c2` int(11) DEFAULT '10',
PRIMARY KEY (`c1`)
) ENGINE=ENGINE DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci
ALTER TABLE t1 ALTER COLUMN c2 DROP DEFAULT;
INSERT INTO t1(c1) VALUES(2);
Warnings:
Warning 1364 Field 'c2' doesn't have a default value
SELECT * FROM t1 ORDER BY c1;
c1 c2
1 10
2 NULL
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`c1` int(11) NOT NULL,
`c2` int(11),
PRIMARY KEY (`c1`)
) ENGINE=ENGINE DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci
DROP TABLE t1;
SHOW TABLES;
Tables_in_test
CREATE TABLE t1(c1 INTEGER NOT NULL PRIMARY KEY, c2 INTEGER);
SHOW TABLES;
Tables_in_test
t1
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`c1` int(11) NOT NULL,
`c2` int(11) DEFAULT NULL,
PRIMARY KEY (`c1`)
) ENGINE=ENGINE DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci
ALTER TABLE t1 ALTER COLUMN c2 SET DEFAULT 10;
INSERT INTO t1(c1) VALUES(1);
SELECT * FROM t1 ORDER BY c1;
c1 c2
1 10
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`c1` int(11) NOT NULL,
`c2` int(11) DEFAULT '10',
PRIMARY KEY (`c1`)
) ENGINE=ENGINE DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci
ALTER TABLE t1 ALTER COLUMN c2 DROP DEFAULT;
INSERT INTO t1(c1) VALUES(2);
Warnings:
Warning 1364 Field 'c2' doesn't have a default value
SELECT * FROM t1 ORDER BY c1;
c1 c2
1 10
2 NULL
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`c1` int(11) NOT NULL,
`c2` int(11),
PRIMARY KEY (`c1`)
) ENGINE=ENGINE DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci
DROP TABLE t1;
SHOW TABLES;
Tables_in_test
CREATE TABLE t1(c1 BIGINT NOT NULL PRIMARY KEY, c2 BIGINT);
SHOW TABLES;
Tables_in_test
t1
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`c1` bigint(20) NOT NULL,
`c2` bigint(20) DEFAULT NULL,
PRIMARY KEY (`c1`)
) ENGINE=ENGINE DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci
ALTER TABLE t1 ALTER COLUMN c2 SET DEFAULT 10;
INSERT INTO t1(c1) VALUES(1);
SELECT * FROM t1 ORDER BY c1;
c1 c2
1 10
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`c1` bigint(20) NOT NULL,
`c2` bigint(20) DEFAULT '10',
PRIMARY KEY (`c1`)
) ENGINE=ENGINE DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci
ALTER TABLE t1 ALTER COLUMN c2 DROP DEFAULT;
INSERT INTO t1(c1) VALUES(2);
Warnings:
Warning 1364 Field 'c2' doesn't have a default value
SELECT * FROM t1 ORDER BY c1;
c1 c2
1 10
2 NULL
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`c1` bigint(20) NOT NULL,
`c2` bigint(20),
PRIMARY KEY (`c1`)
) ENGINE=ENGINE DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci
DROP TABLE t1;
SHOW TABLES;
Tables_in_test
CREATE TABLE t1(c1 REAL NOT NULL PRIMARY KEY, c2 REAL);
SHOW TABLES;
Tables_in_test
t1
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`c1` double NOT NULL,
`c2` double DEFAULT NULL,
PRIMARY KEY (`c1`)
) ENGINE=ENGINE DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci
ALTER TABLE t1 ALTER COLUMN c2 SET DEFAULT 10;
INSERT INTO t1(c1) VALUES(1);
SELECT * FROM t1 ORDER BY c1;
c1 c2
1 10
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`c1` double NOT NULL,
`c2` double DEFAULT '10',
PRIMARY KEY (`c1`)
) ENGINE=ENGINE DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci
ALTER TABLE t1 ALTER COLUMN c2 DROP DEFAULT;
INSERT INTO t1(c1) VALUES(2);
Warnings:
Warning 1364 Field 'c2' doesn't have a default value
SELECT * FROM t1 ORDER BY c1;
c1 c2
1 10
2 NULL
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`c1` double NOT NULL,
`c2` double,
PRIMARY KEY (`c1`)
) ENGINE=ENGINE DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci
DROP TABLE t1;
SHOW TABLES;
Tables_in_test
CREATE TABLE t1(c1 DOUBLE NOT NULL PRIMARY KEY, c2 DOUBLE);
SHOW TABLES;
Tables_in_test
t1
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`c1` double NOT NULL,
`c2` double DEFAULT NULL,
PRIMARY KEY (`c1`)
) ENGINE=ENGINE DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci
ALTER TABLE t1 ALTER COLUMN c2 SET DEFAULT 10;
INSERT INTO t1(c1) VALUES(1);
SELECT * FROM t1 ORDER BY c1;
c1 c2
1 10
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`c1` double NOT NULL,
`c2` double DEFAULT '10',
PRIMARY KEY (`c1`)
) ENGINE=ENGINE DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci
ALTER TABLE t1 ALTER COLUMN c2 DROP DEFAULT;
INSERT INTO t1(c1) VALUES(2);
Warnings:
Warning 1364 Field 'c2' doesn't have a default value
SELECT * FROM t1 ORDER BY c1;
c1 c2
1 10
2 NULL
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`c1` double NOT NULL,
`c2` double,
PRIMARY KEY (`c1`)
) ENGINE=ENGINE DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci
DROP TABLE t1;
SHOW TABLES;
Tables_in_test
CREATE TABLE t1(c1 FLOAT NOT NULL PRIMARY KEY, c2 FLOAT);
SHOW TABLES;
Tables_in_test
t1
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`c1` float NOT NULL,
`c2` float DEFAULT NULL,
PRIMARY KEY (`c1`)
) ENGINE=ENGINE DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci
ALTER TABLE t1 ALTER COLUMN c2 SET DEFAULT 10;
INSERT INTO t1(c1) VALUES(1);
SELECT * FROM t1 ORDER BY c1;
c1 c2
1 10
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`c1` float NOT NULL,
`c2` float DEFAULT '10',
PRIMARY KEY (`c1`)
) ENGINE=ENGINE DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci
ALTER TABLE t1 ALTER COLUMN c2 DROP DEFAULT;
INSERT INTO t1(c1) VALUES(2);
Warnings:
Warning 1364 Field 'c2' doesn't have a default value
SELECT * FROM t1 ORDER BY c1;
c1 c2
1 10
2 NULL
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`c1` float NOT NULL,
`c2` float,
PRIMARY KEY (`c1`)
) ENGINE=ENGINE DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci
DROP TABLE t1;
SHOW TABLES;
Tables_in_test
CREATE TABLE t1(c1 DECIMAL NOT NULL PRIMARY KEY, c2 DECIMAL);
SHOW TABLES;
Tables_in_test
t1
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`c1` decimal(10,0) NOT NULL,
`c2` decimal(10,0) DEFAULT NULL,
PRIMARY KEY (`c1`)
) ENGINE=ENGINE DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci
ALTER TABLE t1 ALTER COLUMN c2 SET DEFAULT 10;
INSERT INTO t1(c1) VALUES(1);
SELECT * FROM t1 ORDER BY c1;
c1 c2
1 10
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`c1` decimal(10,0) NOT NULL,
`c2` decimal(10,0) DEFAULT '10',
PRIMARY KEY (`c1`)
) ENGINE=ENGINE DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci
ALTER TABLE t1 ALTER COLUMN c2 DROP DEFAULT;
INSERT INTO t1(c1) VALUES(2);
Warnings:
Warning 1364 Field 'c2' doesn't have a default value
SELECT * FROM t1 ORDER BY c1;
c1 c2
1 10
2 NULL
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`c1` decimal(10,0) NOT NULL,
`c2` decimal(10,0),
PRIMARY KEY (`c1`)
) ENGINE=ENGINE DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci
DROP TABLE t1;
SHOW TABLES;
Tables_in_test
CREATE TABLE t1(c1 NUMERIC NOT NULL PRIMARY KEY, c2 NUMERIC);
SHOW TABLES;
Tables_in_test
t1
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`c1` decimal(10,0) NOT NULL,
`c2` decimal(10,0) DEFAULT NULL,
PRIMARY KEY (`c1`)
) ENGINE=ENGINE DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci
ALTER TABLE t1 ALTER COLUMN c2 SET DEFAULT 10;
INSERT INTO t1(c1) VALUES(1);
SELECT * FROM t1 ORDER BY c1;
c1 c2
1 10
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`c1` decimal(10,0) NOT NULL,
`c2` decimal(10,0) DEFAULT '10',
PRIMARY KEY (`c1`)
) ENGINE=ENGINE DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci
ALTER TABLE t1 ALTER COLUMN c2 DROP DEFAULT;
INSERT INTO t1(c1) VALUES(2);
Warnings:
Warning 1364 Field 'c2' doesn't have a default value
SELECT * FROM t1 ORDER BY c1;
c1 c2
1 10
2 NULL
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`c1` decimal(10,0) NOT NULL,
`c2` decimal(10,0),
PRIMARY KEY (`c1`)
) ENGINE=ENGINE DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci
DROP TABLE t1;
SHOW TABLES;
Tables_in_test
SET sql_mode=default;