MySQL说:文档
#1064 - 您的SQL语法出错;查看与MariaDB服务器版本对应的手册,以获取正确的语法 靠近' INSERT INTO&#t; tblproduct' (
id
,name
,code
,image
,price
)价值观(1,' 3'第11行
CREATE TABLE IF NOT EXISTS `tblproduct` (
`id` int(8) NOT NULL AUTO_INCREMENT,
`name` varchar(255) NOT NULL,
`code` varchar(255) NOT NULL,
`image` text NOT NULL,
`price` double(10,2) NOT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `product_code` (`code`)
)
INSERT INTO 'tblproduct' (`id`, `name`, `code`, `image`, `price`) VALUES
(1, '3D Camera', '3DcAM01', 'product-images/camera.jpg', 1500.00),
(2, 'External Hard Drive', 'USB02', 'product-images/external-hard-drive.jpg', 800.00),
(3, 'Wrist Watch', 'wristWear03', 'product-images/watch.jpg', 300.00);
答案 0 :(得分:2)
此问题有两个问题;
CREATE TABLE
后遗失tblproduct
并且CREATE TABLE IF NOT EXISTS `tblproduct` (
`id` int(8) NOT NULL AUTO_INCREMENT,
`name` varchar(255) NOT NULL,
`code` varchar(255) NOT NULL,
`image` text NOT NULL,
`price` double(10,2) NOT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `product_code` (`code`)
);
INSERT INTO `tblproduct` (`id`, `name`, `code`, `image`, `price`) VALUES
(1, '3D Camera', '3DcAM01', 'product-images/camera.jpg', 1500.00),
(2, 'External Hard Drive', 'USB02', 'product-images/external-hard-drive.jpg', 800.00),
(3, 'Wrist Watch', 'wristWear03', 'product-images/watch.jpg', 300.00);
使用反引号
{
"name": "vue-mini-social-network",
"version": "1.0.0",
"description": "A mini-social-network created with VueJS!!",
"main": "app.js",
"scripts": {
"start": "nodemon app.js",
"dev": "webpack -d --watch",
"build": "webpack -p --watch"
}
}