我正在尝试添加员工名字但我一直收到错误。我已经尝试过根据类似的问题和我观看过的视频进行更改,但似乎没有什么可以摆脱错误。
create table `Employee Information`.`Employee`(
`EmployeeID` int not null,
`EmployeeFirstName` varchar(255) not null,
`EmployeeLastName` varchar(255) not null,
`SupervisorID` int not null,
primary key (`EmployeeID`),
foreign key (`SupervisorID`) references employee (`EmployeeID`)
on delete no action
on update no action
);
insert into `Employee` (EmployeeID, EmployeeFirstName, EmployeeLastName, SupervisorID) values (1, `John`, `Smith`, 52);
任何帮助?
答案 0 :(得分:0)
您正在使用反引号(\``) for your values rather than regular quotes (
'`)。反引号用于表名和列名。单引号用于字符串,例如值对中的字符串“John”和“Smith”。假设“52”实际上是现有的主管,以下SQL语句将起作用:
INSERT INTO `Employee`
(`EmployeeID`, `EmployeeFirstName`, `EmployeeLastName`, `SupervisorID`)
VALUES (1, 'John', 'Smith', 52)