MySQL错误1054:INSERT中的“字段列表”中的未知列 [英] MySQL Error 1054: Unknown column in 'field list' on INSERT
本文介绍了MySQL错误1054:INSERT中的“字段列表”中的未知列的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我使用MySQL Workbench创建数据库。我有一个名为USERS的表定义如下:
I am using MySQL Workbench to create a database. I have a table called USERS defined as follows:
delimiter $$
CREATE TABLE `users` (
`UID` int(10) unsigned NOT NULL AUTO_INCREMENT
`USERNAME` varchar(20) NOT NULL,
`PASSWORD` varchar(64) NOT NULL
PRIMARY KEY (`UID`),
UNIQUE KEY `USER_NAME_UNIQUE` (`USERNAME`),
KEY `USERS_ROLES_REF_IDX` (`USER_ROLE`),
CONSTRAINT `USERS_ROLES_REF` FOREIGN KEY (`USER_ROLE`) REFERENCES `roles_ref` (`ROLE_NAME`)
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8$$
CREATE
DEFINER=`root`@`localhost`
TRIGGER `MyDB`.`users_after_ins_trig`
AFTER INSERT ON `MyDB`.`users`
FOR EACH ROW
begin
insert into profiles (username) VALUES (new.username);
end
$$
当我转发工程数据库并创建它,脚本给我以下错误。从上面可以看出,用户名是表的一部分。什么给了?
When I go to forward engineer the database and create it, the script gives me the following error. As you can see from above, the username is part of the table. What gives?
Executing SQL script in server
ERROR: Error 1054: Unknown column 'username' in 'field list'
INSERT INTO `MyDB`.`USERS` (`UID`, `USERNAME`, `PASSWORD`)
VALUES (NULL, 'user1', 'blahpassword')
推荐答案
c $ c> profiles 从您的触发器?我猜个人资料
没有用户名列。
Could it be that you are inserting into profiles
from your trigger? I'm guessing profiles
does not have a username column.
这篇关于MySQL错误1054:INSERT中的“字段列表”中的未知列的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文