Error 1054 unknown column in 'field list'

1.4k Views Asked by At

when I execute the INSERT INTO account values(110,1250); statement on the following table

+--------+------------+------+-----+---------+-------+
| Field  | Type       | Null | Key | Default | Extra |
+--------+------------+------+-----+---------+-------+
| acc_no | int(11)    | YES  |     | NULL    |       |
| amount | bigint(20) | YES  |     | NULL    |       |
+--------+------------+------+-----+---------+-------+

I get this error

ERROR 1054 (42S22): Unknown column 'amount' in 'field list'

what can be the cause of it?

Trigger code is

create trigger demo before insert on account 
for each row 
set @diff=@diff+amount; 

As I am learning triggers so I used a basic trigger defination

1

There are 1 best solutions below

0
On

You have to put code like this:

INSERT INTO account values('110', '1250');

If you select varchar in mysql then it should be string. if you select INT in mysql then no need put ''.