How to solve error in mysql when I create table [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 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

Related

Create definer Mysql :ERROR 1064 (42000): You have an error in your SQL syntax [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 9 months ago.
Improve this question
I want to create a procedure but the MySQL command line gives me this error:
mysql> delimiter $$
mysql> use publisher$$
Database changed
mysql> create definer='ashix'#'localhost' procedure 'GroupBookProc' (IN groupIdBook varchar(6))
-> BEGIN
-> select * from GroupBook where groupID = groupIdBook;
-> END $$
ERROR 1064 (42000): 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 ''GroupBookProc' (IN groupIdBook varchar(6))
BEGIN
select * from GroupBook where ' at line 1
What may I do?
thanks, #ErgestBasha
I remove quotes from 'GroupBookProc' and it works

error in your SQL syntax;ON DUPLICATE KEY UPDATE [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
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.

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);