Error #1064 in mysql [duplicate] - mysql

This question already has answers here:
1064 error in CREATE TABLE ... TYPE=MYISAM
(5 answers)
Closed 9 years ago.
I keep getting this 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 AUTO_INCREMENT=58' at line 11
This is my query :
CREATE TABLE `tbl_cart` (
`ct_id` int( 10 ) unsigned NOT NULL AUTO_INCREMENT ,
`pd_id` int( 10 ) unsigned NOT NULL default '0',
`ct_qty` mediumint( 8 ) unsigned NOT NULL default '1',
`ct_session_id` char( 32 ) NOT NULL default '',
`ct_date` datetime NOT NULL default '0000-00-00 00:00:00',
PRIMARY KEY ( `ct_id` ) ,
KEY `pd_id` ( `pd_id` ) ,
KEY `ct_session_id` ( `ct_session_id` )
) TYPE = MYISAM AUTO_INCREMENT =58;
Help Me What the problem is ...

The keyword TYPE is removed since MySQL 5.1, use
) ENGINE = MYISAM AUTO_INCREMENT =58;
instead.

CREATE TABLE `tbl_cart` (
`ct_id` int( 10 ) unsigned NOT NULL AUTO_INCREMENT ,
`pd_id` int( 10 ) unsigned NOT NULL default '0',
`ct_qty` mediumint( 8 ) unsigned NOT NULL default '1',
`ct_session_id` char( 32 ) NOT NULL default '',
`ct_date` datetime NOT NULL default '0000-00-00 00:00:00',
PRIMARY KEY ( `ct_id` ) ,
KEY `pd_id` ( `pd_id` ) ,
KEY `ct_session_id` ( `ct_session_id` )
) ENGINE = MYISAM AUTO_INCREMENT =58;

Related

#1064 - MySQL Error

CREATE TABLE `phpbb_acl_groups` (
`group_id` MEDIUMINT( 8 ) UNSIGNED NOT NULL DEFAULT '0',
`forum_id` MEDIUMINT( 8 ) UNSIGNED NOT NULL DEFAULT '0',
`auth_option_id` MEDIUMINT( 8 ) UNSIGNED NOT NULL DEFAULT '0',
`auth_role_id` MEDIUMINT( 8 ) UNSIGNED NOT NULL DEFAULT '0',
`auth_setting` TINYINT( 2 ) NOT NULL DEFAULT '0',
KEY `group_id` ( `group_id` ) ,
KEY `auth_opt_id` ( `auth_option_id` ) ,
KEY `auth_role_id` ( `auth_role_id` )
) TYPE = MYISAM ;
MySQL meldet: Documentation
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 10
TYPE = MYISAM ; has been depreciated and you should be using engine instead
engine = MYISAM

Error in SQL Syntax. What would be the proper solution or right syntax to use for a successful result?

MySQL said:
#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 '(14) NOT NULL ) ENGINE=MyISAM' at line 23
CREATE TABLE `activity_points` (
`fk_user_id` INT( 10 ) NOT NULL DEFAULT '0',
`date` DATE NOT NULL DEFAULT '0000-00-00',
`points` INT( 10 ) NOT NULL DEFAULT '0',
`lastupdate` TIMESTAMP( 14 ) NOT NULL
) ENGINE = MYISAM ;
TIMESTAMP shouldn't have length
CREATE TABLE `activity_points` (
`fk_user_id` INT( 10 ) NOT NULL DEFAULT '0',
`date` DATE NOT NULL DEFAULT '0000-00-00',
`points` INT( 10 ) NOT NULL DEFAULT '0',
`lastupdate` TIMESTAMP NOT NULL
) ENGINE = MYISAM ;

Syntax error in create table query

I cant get this syntax 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 '(id) ENGINE=MyISAM)' at line 15
CREATE TABLE IF NOT EXISTS `destination_cdr` (
`id` BIGINT( 20 ) NOT NULL AUTO_INCREMENT ,
`calldate` DATETIME NOT NULL ,
`source` VARCHAR( 80 ) NOT NULL ,
`destination` VARCHAR( 80 ) NOT NULL ,
`account_code` VARCHAR( 30 ) DEFAULT NULL ,
`pincode` VARCHAR( 45 ) NOT NULL ,
`duration_call` BIGINT( 20 ) NOT NULL DEFAULT '0',
`duration_talk` BIGINT( 20 ) NOT NULL ,
`disposition` VARCHAR( 255 ) NOT NULL ,
`clid` VARCHAR( 80 ) DEFAULT NULL ,
`cdr_id` BIGINT( 20 ) DEFAULT NULL ,
`vxcdr_id` BIGINT( 20 ) DEFAULT NULL ,
`provider` INT( 11 ) NOT NULL DEFAULT '0' PRIMARY KEY ( `id` )) ENGINE = MYISAM
;
You need a commma between provider and primary Key:
`provider` INT( 11 ) NOT NULL DEFAULT '0', PRIMARY KEY ( `id` )) ENGINE = MYISAM
Missing comma before primary key clause.
`provider` INT( 11 ) NOT NULL DEFAULT '0', PRIMARY KEY ( `id` ))
Error
SQL query:
--
-- Database: wadud
--
-- Table structure for table destination
CREATE TABLE destination (
id bigint(20) NOT NULL,
country varchar(255) NOT NULL,
photo text NOT NULL,
tours varchar(255) NOT NULL,
created_at timestamp NULL DEFAULT NULL,
updated_at timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8
MySQL said: Documentation
1050 - Table 'destination' already exists

Why won't MySQL statement work?

I am using PHPMyAdmin right now and I am creating a new table with these values below but it's not working and I can't see why at all.
SQL query:
CREATE TABLE `database`.`hub_attendance_lessons` (
`id` BIGINT( 10 ) UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY ,
`lesson_id` BIGINT( 10 ) UNSIGNED NOT NULL ,
`course_id` BIGINT( 10 ) UNSIGNED NOT NULL ,
`student_id` BIGINT( 10 ) UNSIGNED NOT NULL ,
`date` BIGINT( 10 ) UNSIGNED NOT NULL ,
`attended` BOOL( 2 ) UNSIGNED NULL ,
`absent` BOOL( 2 ) UNSIGNED NULL ,
`excused_absent` BOOL( 2 ) UNSIGNED NULL ,
`late` BOOL( 2 ) UNSIGNED NULL ,
`excused_late` BOOL( 2 ) UNSIGNED NULL
)
ENGINE = MYISAM CHARACTER SET utf8 COLLATE utf8_general_ci
COMMENT = 'stores the attendance of all lessons for all students';
MySQL said:
#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 '(2) UNSIGNED NULL, absent
BOOL(2) UNSIGNED NULL, `excused_absent` BOOL(2) UNSI' at line 1
BOOL and BOOLEAN are just shorthand for TINYINT(1). It makes no sense to have a BOOL(2). Remove all lengths of 2 for your booleans.

MYSQL Error #1064 Error in SQL Syntax

I keep getting this error:
MySQL said: Documentation
#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 'USING BTREE
) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=13' at line 11
with this with this query:
SQL query:
CREATE TABLE IF NOT EXISTS `jml_usergroups` (
`id` int( 10 ) unsigned NOT NULL AUTO_INCREMENT COMMENT 'Primary Key',
`parent_id` int( 10 ) unsigned NOT NULL DEFAULT '0' COMMENT 'Adjacency List Reference Id',
`lft` int( 11 ) NOT NULL DEFAULT '0' COMMENT 'Nested set lft.',
`rgt` int( 11 ) NOT NULL DEFAULT '0' COMMENT 'Nested set rgt.',
`title` varchar( 100 ) NOT NULL DEFAULT '',
PRIMARY KEY ( `id` ) ,
UNIQUE KEY `idx_usergroup_parent_title_lookup` ( `parent_id` , `title` ) ,
KEY `idx_usergroup_title_lookup` ( `title` ) ,
KEY `idx_usergroup_adjacency_lookup` ( `parent_id` ) ,
KEY `idx_usergroup_nested_set_lookup` ( `lft` , `rgt` ) USING BTREE
) ENGINE = MYISAM DEFAULT CHARSET = utf8 AUTO_INCREMENT =13;
Any idea what the problem is? these errors are like the thorns on a rose
The syntax is ok, your problem is probably that you're trying to run it on a MySQL version earlier than 5.1, which does not have USING BTREE.