Reputation: 70
INSERT INTO `student`(`Name`, `Student_number`, `Class`, `Major`)
VALUES (Smith,17,1,CS),(Brown,8,2,CS)
1054 - Unknown column 'Smith' in 'field list'
I am looking from http://dev.mysql.com/doc/refman/5.1/en/insert.html but I still got error.
I do not understand what I'm missing.
My student table is
name char(30),
Student_number int primary key,
Class int,
Major char(30)
Upvotes: 1
Views: 6471
Reputation: 77896
Here Smith
is a string literal and you need to quote around string literal values like below else your DB engine will consider it as column/field.
VALUES ('Smith',17,1,'CS')
Your query should look like
INSERT INTO `student`(`Name`, `Student_number`, `Class`, `Major`)
VALUES ('Smith',17,1,'CS'),('Brown',8,2,'CS')
Upvotes: 8