error (1064) while creating table in mysql [duplicate] - mysql

This question already has answers here:
1064 error in CREATE TABLE ... TYPE=MYISAM
(5 answers)
Closed 9 years ago.
I am using mysql db(version 5.5) and using mysql query browser(v 1.1.5) .But when i try to create a simple table using query browser am getting following error:
CREATE TABLE `tstaks`.`employee` (
`empid` INTEGER UNSIGNED NOT NULL AUTO_INCREMENT,
`name` VARCHAR(45) NOT NULL,
PRIMARY KEY(`empid`)
)
TYPE = InnoDB;
mysql error no 1064
you have an error in your sql sytax,check the manual that corresponds to your mysqlserver version for right syntax to use
near type ='innoDB

TYPE needs to be ENGINE: ENGINE=InnoDB

Related

1064 You have an error in your SQL syntax [duplicate]

This question already has answers here:
How can I fix MySQL error #1064?
(3 answers)
Closed 2 years ago.
I have had a problem since working with the new MYSQL version 8.0.18.
Always get the same error message:
SQLSTATE [42000]: Syntax error or access violation: 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 'function) VALUES (?,?,?,?,?)
DROP TABLE IF EXISTS bugtracker1_product_status;
CREATE TABLE bugtracker1_product_status (
statusID INT(10) NOT NULL AUTO_INCREMENT PRIMARY KEY,
productID INT(10),
statusTitle VARCHAR(255) NOT NULL DEFAULT '',
type ENUM('bug','suggestion') NOT NULL DEFAULT 'bug',
function ENUM('duplicate','solved','outstanding') NOT NULL DEFAULT 'outstanding',
cssClassName VARCHAR(255) NOT NULL DEFAULT '',
showOrder INT(10) NOT NULL DEFAULT 0,
KEY (productID)
);
Where is the problem?
function ENUM('duplicate','solved','outstanding') NOT NULL DEFAULT 'outstanding',
It works in the MariaDB
Thanks for your help!
Thank you for your support, but unfortunately this does not lead to success. The error remains.
`function` ENUM('duplicate','solved','outstanding') NOT NULL DEFAULT 'outstanding',
Could not prepare statement 'INSERT INTO bugtracker1_product_status (productID, statusTitle, cssClassName, type, function) VALUES (?,?,?,?,?)'
Is there no alternative?
FUNCTION (R); became reserved in 8.0.1
function is a reserved keyword in MySQL. You need to escape it with backticks:
`function` ENUM...
The MySQL docs state that it became reserved in version 8.0.1

Query for altering column to be nullabe not working [duplicate]

This question already has answers here:
How to add not null constraint to existing column in MySQL
(3 answers)
Closed 3 years ago.
I need to make column called start_date_data_id to be nullable.
I found this answer(Altering a column to be nullable) and tried to do it on described way.
Description of that column: (| start_date_data_id| bigint(20)| NO | MUL | NULL | |).
Query:
ALTER TABLE attenddb.company_group_user_settings
ALTER COLUMN start_date_data_id bigint(20) NULL;
Error:
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 'bigint(20) NULL' at line 1
Can someone tell me why is it not working?
Try this:
ALTER TABLE attenddb.company_group_user_settings
MODIFY start_date_data_id bigint(20) NULL;

Unable to create table with column name "schemas" [duplicate]

This question already has answers here:
Is "key" a reserved word in MySqli? I'm getting an error
(2 answers)
Closed 6 years ago.
When I tried to execute following statement.
create table user_schemas (user_id varchar(255) not null, schemas varchar(255));
I am getting following error.
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 'schemas varchar(255))' at line 1
When I change the column name "schemas" to something else, it is working fine.
mysql> create table user_schemas (user_id varchar(255) not null, schemas varchar(255));
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 'schemas varchar(255))' at line 1
mysql>
mysql> create table user_schemas (user_id varchar(255) not null, rules varchar(255));
Query OK, 0 rows affected (0.01 sec)
Any idea on how to solve this problem??
If you want to use reserved words in the SQL syntax you must use Backticks (`) like:
create table user_schemas (
user_id varchar(255) not null,
`schemas` varchar(255)
);

mysql error cant fix the error [duplicate]

This question already has answers here:
How can I fix MySQL error #1064?
(3 answers)
Closed 8 years ago.
I get an error from MySQL:
#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 'TYPE=MyISAM AUTO_INCREMENT=7 AUTO_INCREMENT=7' at line 6
My SQL is:
CREATE TABLE IF NOT EXISTS `default_setup_academic` (
`academic_id` bigint(20) NOT NULL auto_increment,
`academic_name` text NOT NULL,
`academic_order` bigint(20) NOT NULL,
PRIMARY KEY (`academic_id`)
) TYPE=MyISAM AUTO_INCREMENT=7 AUTO_INCREMENT=7 ;
Why does that have an error?
TYPE is no longer in use.
Go with ENGINE
ENGINE=MyISAM
2 issues You have AUTO_INCREMENT=7 2 times and change the type to
ENGINE
CREATE TABLE IF NOT EXISTS
default_setup_academic
(
academic_id bigint(20) NOT NULL auto_increment,
academic_name text NOT NULL,
academic_order bigint(20) NOT NULL,
PRIMARY KEY (academic_id)
) ENGINE=MyISAM AUTO_INCREMENT=7 ;

sql tutorial script error [duplicate]

This question already has answers here:
1064 error in CREATE TABLE ... TYPE=MYISAM
(5 answers)
Closed 9 years ago.
The SQL text that it tells you to copy and paste into phpMyAdmin's SQL page from this tutorial gives me the 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 'TYPE=MyISAM' at line 6
This is the script:
CREATE TABLE `scores` (
`id` INT(10) UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY,
`name` VARCHAR(15) NOT NULL DEFAULT 'anonymous',
`score` INT(10) UNSIGNED NOT NULL DEFAULT '0'
)
TYPE=MyISAM;
What am I getting wrong here?
It should be ENGINE=MyISAM instead of TYPE=MyISAM.
Yes. TYPE is not work for MyISAM.
**TYPE** must be **ENGINE** .
This is common problem!