MYSQL基础管理-auto_increment测试应用

mysql> create table tid (id int not null auto_increment,name varchar(100) ,prima
ry key(id));
Query OK, 0 rows affected (0.11 sec)

mysql>
mysql>
mysql> insert into tid values('123');
ERROR 1136 (21S01): Column count doesn't match value count at row 1
mysql> insert into tid(name) values('123');
Query OK, 1 row affected (0.02 sec)

mysql> commit;
Query OK, 0 rows affected (0.00 sec)

mysql> select * from tid;
+----+------+
| id | name |
+----+------+
|  1 | 123  |
+----+------+
1 row in set (0.01 sec)

mysql> insert into tid(name) values('1111');
Query OK, 1 row affected (0.01 sec)

mysql> insert into tid(name) values('1111');
Query OK, 1 row affected (0.02 sec)

mysql> insert into tid(name) values('1111');
Query OK, 1 row affected (0.01 sec)

mysql> insert into tid(name) values('1111');
Query OK, 1 row affected (0.01 sec)

mysql> insert into tid(name) values('1111');
Query OK, 1 row affected (0.01 sec)

mysql> insert into tid(name) values('1111');
Query OK, 1 row affected (0.01 sec)

mysql> insert into tid(name) values('1111');
Query OK, 1 row affected (0.01 sec)

mysql> insert into tid(name) values('1111');
Query OK, 1 row affected (0.02 sec)

mysql> select * from tid;
+----+------+
| id | name |
+----+------+
|  1 | 123  |
|  2 | 1111 |
|  3 | 1111 |
|  4 | 1111 |
|  5 | 1111 |
|  6 | 1111 |
|  7 | 1111 |
|  8 | 1111 |
|  9 | 1111 |
+----+------+
9 rows in set (0.00 sec)

mysql> show create table tid\G
*************************** 1. row ***************************
       Table: tid
Create Table: CREATE TABLE `tid` (
  `id` int NOT NULL AUTO_INCREMENT,
  `name` varchar(100) DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=10 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_a
i_ci
1 row in set (0.01 sec)

mysql>
 

你可能感兴趣的:(MYSQL基础管理,mysql,adb,android)