简体   繁体   English

错误1241(21000):简单插入时,操作数应包含1列

[英]ERROR 1241 (21000): Operand should contain 1 column(s) on simple insert

I keep getting that error 我不断收到这个错误

ERROR 1241 (21000): Operand should contain 1 column(s). 错误1241(21000):操作数应包含1列。

I have table Deck which has DeckId, PlayerId, CardId (player and card are foreign keys from table Collection ). 我有Deck表,其中有DeckId, PlayerId, CardId (player和card是表Collection中的外键)。 And all three are primary key for that table. 所有这三个都是该表的主键。 I am trying to do simple Insert on Deck. 我正在尝试在Deck上进行简单的插入。

INSERT INTO Deck (DeckId, PlayerId, CardId) 
VALUES (1, 1, 1);

And I keep getting that error. 而且我不断收到该错误。 I modeled database with MySql workbench. 我使用MySql工作台为数据库建模。 Deck is dependent on Collection , it has identifying 1:m relationship. Deck依赖于Collection ,它具有可识别的1:m关系。 I don't know if that may be causing problems. 我不知道这是否可能引起问题。

Here is paste for create schema , triggers . 这是用于创建架构触发器的粘贴。 Names are not in English. 名称不是英文。 It is model of DB for card game Hearthstone, dunno if I should use that name, but it is for a school project, I guess professor won't mind. 它是纸牌游戏《炉石传说》的数据库模型,如果我要使用该名称,那就不知道了,但这是用于学校项目的,我想教授不会介意的。

I found what the mistake was. 我发现了错误所在。

It was not problem in insert statement but in create trigger statement. 在插入语句中不是问题,但在创建触发器语句中不是问题。 It returned 2 rows instead of 1. Thank you all. 它返回2行而不是1行。谢谢大家。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM