我正在创建一个名为bamazonManager.js的新Node应用程序。运行此应用程序将:
我正在努力在MySQL中创建数据库设置 - 错误不断出现"第1行和第34行中的MySQL错误 - 我可能需要再看一眼。
DROP DATABASE IF EXISTS manager_viewDB;
CREATE DATABASE manager_viewDB;
use manager_viewDB;
CREATE TABLE products (
item_id INT(11) NOT NULL AUTO_INCREMENT,
item_name VARCHAR(20) CHARACTER SET utf8,
department_name varchar(50) DEFAULT NULL,
item_price INT(11) DEFAULT NOT NULL,
item_quantity int(11) DEFAULT NOT NULL,
PRIMARY KEY (item_id)
);
SELECT * FROM products;
INSERT INTO products (item_name, department_name, item_price, item_quantity)
VALUES("Mini Mac", "Computers", 689, 10);
SELECT * FROM products;
INSERT INTO products (item_name, department_name, item_price, item_quantity)
VALUES("ECHO plus", "Amazon Devices", 79.99, 10);
SELECT * FROM products;
INSERT INTO products (item_name, department_name, item_price, item_quantity)
VALUES("Funny Cat Mug", "Handmade", 20, 10);
SELECT * FROM products;
INSERT INTO products (item_name, department_name, item_price, item_quantity)
VALUES("Wine Barell Top Mirror", "Home and Kitchen", 328, 10);
SELECT * FROM products;
INSERT INTO products (item_name, department_name, item_price, item_quantity)
VALUES("Hand Stamped Bracelets", "Wedding", 20, 10);
SELECT * FROM products;
INSERT INTO products (item_name, department_name, item_price, item_quantity)
VALUES("Kawaii - Animal Plush", 22, 10);
SELECT * FROM products;
INSERT INTO products (item_name, department_name, item_price, item_quantity)
VALUES("Weave Blanket - MDA", "Handmade", 60, 10);
SELECT * FROM products;
INSERT INTO products (item_name, department_name, item_price, item_quantity)
VALUES("Retro Tiki - Cellphone", "Handbags and Accessories", 22, 10);
SELECT * FROM products;
INSERT INTO products (item_name, department_name, item_price, item_quantity)
VALUES("Handmade Leather Bag", "Handbags and Accessories", 70, 10);
SELECT * FROM products;
INSERT INTO products (item_name, department_name, item_price, item_quantity)
VALUES("Devialet Gold Phantom", "Electronics", 2990, 10);
答案 0 :(得分:1)
我在这里看到一些问题。
在创建表时删除DEFAULT或指定DEFAULT值。
您的item_name只有20个字符,但您尝试插入的字符长于此字符。
另外,VALUES(" Kawaii - Animal Plush",22,10)只有3个值,期待4。