我用create database创建了一个库member并建了2个表users和password;
当我用insert into users values("user1",password("1234"));添加纪录时出现如下提示:
ERROR 1136: Column count doesn't match value count at row 1
请问该如何解决?
:)
...全文
3017打赏收藏
添加纪录问题;
我用create database创建了一个库member并建了2个表users和password; 当我用insert into users values("user1",password("1234"));添加纪录时出现如下提示: ERROR 1136: Column count doesn't match value count at row 1 请问该如何解决? :)
咱们一个个来:
1、
mysql> insert into users values("admin","admin");
ERROR 1136: Column count doesn't match value count at row 1
解答:
这是因为在你的users表中只有一个字段,而你在插入时却写了两个字段,
所以报表的Column数与你所给定的值数目不匹配
2、
mysql> create
-> table users2
-> (
-> username varchar(20),
-> password varchar(20),
-> )
-> ;
ERROR 1064: You have an error in your SQL syntax. Check the manual that corresp
onds to your MySQL server version for the right syntax to use near ')' at line 6
mysql> create
-> table users2
-> (
-> username varchar(20),
-> password varchar(20),
-> )
-> ;
ERROR 1064: You have an error in your SQL syntax. Check the manual that corresp
onds to your MySQL server version for the right syntax to use near ')' at line 6
mysql> use member
Database changed
mysql> create table users2 (
-> username char(20),
-> password char(20),
-> );
ERROR 1064: You have an error in your SQL syntax. Check the manual that corresp
onds to your MySQL server version for the right syntax to use near ')' at line 4