mysql SQL ...插入语句时出现问题[重复]

c3frrgcw  于 5个月前  发布在  Mysql
关注(0)|答案(1)|浏览(57)

此问题在此处已有答案

When to use single quotes, double quotes, and backticks in MySQL(13个回答)
19天前关闭.

CREATE TABLE easy_drinks(drink_name VARCHAR(20), main VARCHAR(10),amount1 DEC(3,1),second VARCHAR(25), amount2 DEC(3,2),directions VARCHAR(255)); 
INSERT INTO easy_drinks
(drink_name,main,amount1,second, amount2,directions) 
VALUES
(‘Black thorn’,’tonicwater’,1.5 ,’pineapple_juice’,1 ,’stir with ice,strain into cocktail glass with lemon twist’), 
(‘BlueMoon’,’soda’,1.5,’blueberry_juice’,0.75, ‘strain into cocktail glass with lemon twist),
 (Ohmygosh’,’peach_nectar’,1,’pineapple_juice’,1,’stir with ice’,’strain into shot glass’),
 (‘Lime_fizz’,’sprite’,1.5,’lime_juice’,0.75,’stir with ice,strain into a cocktail glass), 
(‘kiss on lips’,’cherry juice’,2,’apricot nector’,7,’serve over ice with straw’), 
(‘hot gold’,’peach nectar’,3,’orange juice’,6,’pour hot orange juice in mug and peach nectar’), (‘lone tree,’soda’,1.5,’cherry juice’,0.75,’stir with ice,strain into cocktail glass), (‘greyhound’,’soda’,1.5,’grapefruit juice’,5,’serve with ice,stir well’), (‘indian summer’,’apple juice’,2,’hot tea’,6,’add juice to mug and topoff with hot tea’), (‘bullfrog’,’iced tea’,1.5,’lemonade’,5,’serve over ice with lime slice’), (‘soda and it’,’soda’,2,’grape juice’,1,’shake in cocktail glass,no ice’);

这是我用来创建一个表,并添加到它的数据,但它显示我这个错误
您的SQL语法中有一个错误;请检查与您的MySQL服务器版本对应的手册,以了解在第4行的'thorn','tonicwater',1.5,'pineapple_juice',1,'stir with ice,strain '附近使用的正确语法
这是得到创建我有插入到问题有人能告诉我是什么问题吗
我试着改变数据表仍然没有用我想用所有的数据创建一个表。

0qx6xfy6

0qx6xfy61#

我有时也会遇到类似的错误。由于我不知道的原因,SQL将您输入的'解释为一个不“直”的撇号,它需要一个直撇号。请尝试粘贴下面的代码。

CREATE TABLE easy_drinks (
    drink_name VARCHAR(20),
    main VARCHAR(10),
    amount1 DEC(3,1),
    second VARCHAR(25),
    amount2 DEC(3,2),
    directions VARCHAR(255)
);

INSERT INTO easy_drinks (drink_name, main, amount1, second, amount2, directions) VALUES
('Black thorn', 'tonicwater', 1.5, 'pineapple_juice', 1, 'stir with ice, strain into cocktail glass with lemon twist'),
('BlueMoon', 'soda', 1.5, 'blueberry_juice', 0.75, 'strain into cocktail glass with lemon twist'),
('Ohmygosh', 'peach_nectar', 1, 'pineapple_juice', 1, 'stir with ice, strain into shot glass'),
('Lime_fizz', 'sprite', 1.5, 'lime_juice', 0.75, 'stir with ice, strain into a cocktail glass'),
('kiss on lips', 'cherry juice', 2, 'apricot nector', 7, 'serve over ice with straw'),
('hot gold', 'peach nectar', 3, 'orange juice', 6, 'pour hot orange juice in mug and peach nectar'),
('lone tree', 'soda', 1.5, 'cherry juice', 0.75, 'stir with ice, strain into cocktail glass'),
('greyhound', 'soda', 1.5, 'grapefruit juice', 5, 'serve with ice, stir well'),
('indian summer', 'apple juice', 2, 'hot tea', 6, 'add juice to mug and top off with hot tea'),
('bullfrog', 'iced tea', 1.5, 'lemonade', 5, 'serve over ice with lime slice'),
('soda and it', 'soda', 2, 'grape juice', 1, 'shake in cocktail glass, no ice');

字符串

相关问题