error in your SQL syntax;ON DUPLICATE KEY UPDATE [closed] - mysql
Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 2 years ago.
Improve this question
Trying the below commands on MySQL 5.6 but getting syntax error.
INSERT INTO device
( uid, name, type, os, device_active,
screen_resolution, network_type,status)
VALUES ('1110b','XIAOMI','Android','Android 10',
false,'2340*1080','WIFI',1),
('A2QD1','HUAWEI','Android','Android 7.0',
true,'1920*1080','WIFI',1) As new
ON DUPLICATE KEY
UPDATE device_active = VALUES(new.device_active);
Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'As new ON DUPLICATE KEY UPDATE device_active = VALUES(new.device_active)'
NEW. values are only available in triggers VALUES(device_active) should be enough.
Related
How to solve error in mysql when I create table [closed]
Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers. This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers. Closed 1 year ago. Improve this question When I create a table using the following statement, I get an error. CREATE TABLE HOTEL(ROOM_NUMBER, check_in_date, check_out_date) Error: Error Code: 1064. You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ', check_in_date, check_out_date)' at line 1 What can I do to solve this?
you must have to define datatype like this: CREATE TABLE HOTEL( ROOM_NUMBER int, check_in_date datetime, check_out_date datetime ); source
corresponds to your MySQL server [closed]
Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers. This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers. Closed 2 years ago. Improve this question [What's wrong with that code! it doesn't run? CREATE TABLE student( student_id INT PRIMARY KEY, major VARCHAR(20), ); You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ')' at line 5
Get rid of that trailing comma after VARCHAR(20).
MySQL - Syntax error when trying to insert strings/numbers [closed]
Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers. This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers. Closed 7 years ago. Improve this question I get the below error: 1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '('text','text','text',1,2,3,4,5,6,7,' at line 4 when trying to run this SQL command: insert into `table` VALUES (`col1`,`col2`,`col3`,`col4`,`col5`,`col6`,`col7`,`col8`,`col9`,`col10`,`col11`,`col12`,`col13`,`col14`) ('text','text','text',1,2,3,4,5,6,7,8,'text','text','text'), ('text','text','text',11,12,13,14,15,16,17,18,'text','text','text') UPDATE: I'm a complete moron, added col names before VALUES...
insert into `table` (`col1`,`col2`,`col3`,`col4`,`col5`,`col6`,`col7`,`col8`,`col9`,`col10`,`col11`,`col12`,`col13`,`col14`) VALUES ('text','text','text',1,2,3,4,5,6,7,8,'text','text','text'), ('text','text','text',11,12,13,14,15,16,17,18,'text','text','text')
insert into `table`(`col1`,`col2`,`col3`,`col4`,`col5`,`col6`,`col7`,`col8`,`col9`,`col10`,`col11`,`col12`,`col13`,`col14`) VALUES('text','text','text',1,2,3,4,5,6,7,8,'text','text','text'), ('text','text','text',11,12,13,14,15,16,17,18,'text','text','text')
insert into `table` (`col1`,`col2`,`col3`,`col4`,`col5`,`col6`,`col7`,`col8`,`col9`,`col10`,`col11`,`col12`,`col13`,`col14`) VALUES ('text','text','text',1,2,3,4,5,6,7,8,'text','text','text') , ('text','text','text',11,12,13,14,15,16,17,18,'text','text','text')
Syntax error when adding SQL column [closed]
Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers. This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers. Closed 8 years ago. Improve this question I have a database called "members" and in that there's a table called "test". I'm trying to add a column to the table "test" but am getting the following error MySQL Error 1064: You have an error in your SQL syntax. My SQL code: ALTER TABLE 'test' ADD COLUMN 'Email' VARCHAR(25) NULL AFTER 'LastName';
alter table classtest add column Email varchar(25);
INSERT SQL error [closed]
Closed. This question needs to be more focused. It is not currently accepting answers. Want to improve this question? Update the question so it focuses on one problem only by editing this post. Closed 8 years ago. Improve this question i have this in my script: $db->q("INSERT INTO 'keys' (key,grupo,dias) VALUES ('$key','VIP',$love);"); which generates sql like this INSERT INTO 'keys' ('key','grupo','dias') VALUES ('35F3','VIP',28) but i get You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''keys' ('key','grupo','dias') VALUES ('35F3','VIP',28)' at line 1 I'm adding screenshot of my table's structure: http://i.stack.imgur.com/luKfm.png Thanks for ur help!
Tables names are identfiers not string literals. So in the case that they are escape, you should use backticks, INSERT INTO `keys` (`key`,`grupo`,`dias`) VALUES ('35F3','VIP',28) MySQL - when to use single quotes, double quotes, and backticks? MySQL Reserved Keywords List (where backticks are applicable)