#1064...........at ENGINE =MyISAM' at line 15 - mysql

Here is my code
CREATE TABLE IF NOT EXISTS `Employees` (
`EmployeeID` VARCHAR( 6 ) NOT NULL DEFAULT '',
`FullName` VARCHAR( 35 ) NOT NULL DEFAULT '',
`EntryYMD` DATE NOT NULL DEFAULT '0000-00-00',
`PartTime` TINYINT( 3 ) NOT NULL DEFAULT '100',
`Mo` TINYINT( 1 ) NOT NULL DEFAULT '8',
`Tu` TINYINT( 1 ) NOT NULL DEFAULT '8',
`We` TINYINT( 1 ) NOT NULL DEFAULT '8',
`Th` TINYINT( 1 ) NOT NULL DEFAULT '8',
`Fr` TINYINT( 1 ) NOT NULL DEFAULT '8',
`Sa` TINYINT( 1 ) NOT NULL DEFAULT '0',
`Su` TINYINT( 1 ) NOT NULL DEFAULT '0',
`Version` INT( 8 ) NOT NULL DEFAULT '0',
`Changed` SMALLINT( 1 ) NOT NULL DEFAULT '1',
`Time_Stamp` TIMESTAMP( 14 ) NOT NULL ,
PRIMARY KEY ( `EmployeeID` ) ,
) ENGINE = MYISAM;
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,
PRIMARY KEY (EmployeeID),
)ENGINE =MyISAM' at line 15

Related

Database not importing

Error
##
--
-- Database: verticalned
-- --------------------------------------------------------
-- Table structure for table announcements
CREATE TABLE `announcements` (
`id` INT( 10 ) NOT NULL ,
`description` VARCHAR( 6000 ) DEFAULT NULL ,
`links` VARCHAR( 100 ) DEFAULT NULL ,
`first` TINYINT( 1 ) DEFAULT > NULL ,
`second` TINYINT( 1 ) DEFAULT NULL ,
`third` TINYINT( 1 ) DEFAULT NULL ,
`fourth` TINYINT( 1 ) DEFAULT NULL ,
`staff` VARCHAR( 22 ) DEFAULT NULL ,
`time` DATETIME( 2 ) DEFAULT NULL ,
`subject` VARCHAR( 100 ) DEFAULT NULL
) ENGINE = INNODB DEFAULT CHARSET = latin1;
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 '(2) DEFAULT NULL, subject varchar(100) DEFAULT NULL )
ENGINE=InnoDB DEFAULT ' at line 20
version
Looks like the mysql version you are using (probably older than 5.6.4) does not accept precision (fractional seconds). You can bypass the issue by replacing ..., time DATETIME(2) DEFAULT NULL ,... with ... , time DATETIME DEFAULT NULL ,....
However, you should solve the issue by either changing the data type to timestamp or upgrading MySQL server to a version later than 5.6.4
CREATE TABLE `announcements` (
`id` INT(10) NOT NULL,
`description` VARCHAR(6000) DEFAULT NULL,
`links` VARCHAR(100) DEFAULT NULL,
`first` TINYINT( 1 ) DEFAULT NULL ,
`second` TINYINT( 1 ) DEFAULT NULL ,
`third` TINYINT( 1 ) DEFAULT NULL ,
`fourth` TINYINT( 1 ) DEFAULT NULL ,
`staff` VARCHAR( 22 ) DEFAULT NULL ,
`time` DATETIME( 2 ) DEFAULT NULL ,
`subject` VARCHAR( 100 ) DEFAULT NULL
) ENGINE = INNODB DEFAULT CHARSET = latin1;
obvoiusly theres nothing wrongn with your code. just add the slanted quotes
CREATE TABLE announcements (
id INT NOT NULL ,
description VARCHAR( 6000 ) DEFAULT NULL ,
links VARCHAR( 100 ) DEFAULT NULL ,
firstTINYINT DEFAULT NULL ,
secondTINYINT DEFAULT NULL,
thirdTINYINT DEFAULT NULL ,
fourthTINYINT DEFAULT NULL,
staffVARCHAR(22) DEFAULT NULL ,
timeDATETIME DEFAULT NULL ,
subject` VARCHAR( 100 ) DEFAULT NULL
) ENGINE = INNODB DEFAULT CHARSET = latin1;
Please remove character number from INT and TINYINT, and add the slanted quotes your code should work.

error upload .sql file of wordpress site

this is 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 'AS ical subscribe access key,
created_on datetime DEFAULT NULL,
`updated' at line 20
Erreur
requĂȘte SQL:
-- --------------------------------------------------------
--
-- Structure de la table `pec_calendars`
--
CREATE TABLE `pec_calendars` (
`id` INT( 11 ) UNSIGNED NOT NULL ,
`type` ENUM( 'user', 'group', 'url' ) DEFAULT 'user',
`user_id` INT( 11 ) UNSIGNED DEFAULT NULL ,
`name` VARCHAR( 100 ) DEFAULT NULL ,
`description` TEXT,
`color` VARCHAR( 7 ) DEFAULT NULL ,
`admin_id` INT( 11 ) DEFAULT NULL ,
`status` ENUM( 'on', 'off' ) DEFAULT 'on',
`show_in_list` ENUM( '0', '1' ) DEFAULT NULL ,
`public` TINYINT( 3 ) UNSIGNED DEFAULT '0',
`reminder_message_email` TEXT,
`reminder_message_popup` TEXT,
`access_key` VARCHAR( 32 ) DEFAULT NULL COMMENT AS `ical subscribe access key` ,
`created_on` DATETIME DEFAULT NULL ,
`updated_on` DATETIME DEFAULT NULL
) ENGINE = INNODB DEFAULT CHARSET = utf8;
Guess your query should be:
CREATE TABLE pec_calendars
(
id INT(11) UNSIGNED NOT NULL,
type ENUM('user', 'group', 'url') DEFAULT 'user',
user_id INT(11) UNSIGNED DEFAULT NULL,
name VARCHAR(100) DEFAULT NULL,
description TEXT,
color VARCHAR(7) DEFAULT NULL,
admin_id INT(11) DEFAULT NULL,
status ENUM('on', 'off') DEFAULT 'on',
show_in_list ENUM('0', '1') DEFAULT NULL,
public TINYINT(3) UNSIGNED DEFAULT '0',
reminder_message_email TEXT,
reminder_message_popup TEXT,
access_key VARCHAR(32) DEFAULT NULL,
created_on DATETIME DEFAULT NULL,
updated_on DATETIME DEFAULT NULL
)
engine = innodb
DEFAULT charset = utf8;

Table Creation Error [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
Looking to fix the syntax error
Error Message:
force int(9) NOT NULL default '0', perm tinyint(1) NOT NULL default
'0', act' at line 11
My Table Syntax:
CREATE TABLE `ttp_sites` (
siteid int( 4 ) NOT NULL AUTO_INCREMENT ,
wname char( 64 ) NOT NULL default '',
email char( 64 ) NOT NULL default '',
siteurl char( 255 ) NOT NULL default '',
sitename char( 128 ) NOT NULL default '',
furl char( 255 ) NOT NULL default '',
icqnumb char( 20 ) default '',
icqname char( 20 ) default '',
sent int( 9 ) NOT NULL default '0',
FORCE int( 9 ) NOT NULL default '0',
perm tinyint( 1 ) NOT NULL default '0',
active tinyint( 1 ) NOT NULL default '0',
manage_type tinyint( 1 ) NOT NULL default '0',
send_ratio int( 4 ) NOT NULL default '0',
PRIMARY KEY ( siteid ) ,
KEY siteurl( siteurl ) ,
KEY sitename( sitename ) ,
KEY active( active )
) ENGINE = MYISAM DEFAULT CHARSET = latin1 AUTO_INCREMENT =1;
The issue with your code is you have used a reserved keyword FORCE , you can use the reserve keyword to create a table column name is by giving the name within single quotes which takes the keyword as a name.
CREATE TABLE `ttp_sites` (
siteid int( 4 ) NOT NULL AUTO_INCREMENT ,
wname char( 64 ) NOT NULL default '',
email char( 64 ) NOT NULL default '',
siteurl char( 255 ) NOT NULL default '',
sitename char( 128 ) NOT NULL default '',
furl char( 255 ) NOT NULL default '',
icqnumb char( 20 ) default '',
icqname char( 20 ) default '',
sent int( 9 ) NOT NULL default '0',
`FORCE` int( 9 ) NOT NULL default '0',
perm tinyint( 1 ) NOT NULL default '0',
active tinyint( 1 ) NOT NULL default '0',
manage_type tinyint( 1 ) NOT NULL default '0',
send_ratio int( 4 ) NOT NULL default '0',
PRIMARY KEY ( siteid ) ,
KEY siteurl( siteurl ) ,
KEY sitename( sitename ) ,
KEY active( active )
) ENGINE = MYISAM DEFAULT CHARSET = latin1 AUTO_INCREMENT =1;
Sql Fiddle
P.s : Don't use keyword for naming a column.
Updated Query of your's in the comment
CREATE TABLE ttp_traffic
( siteid int(4) NOT NULL default '0',
ipaddr char(25) NOT NULL default '',
click int(3) NOT NULL default '0',
prox int(1) NOT NULL default '0',
refer char(255) NOT NULL default '',
datev timestamp NOT NULL,
KEY siteid (siteid),
KEY datev (datev),
KEY click (click),
KEY ipaddr (ipaddr) )ENGINE = MYISAM;
Timestamp should not have datatype size that was the error in your code
SQl Fiddle

SQL syntax error

CREATE TABLE `users` (
`id` INT UNSIGNED NOT NULL AUTO_INCREMENT ,
`type` ENUM( `member` , `admin` ) NOT NULL ,
`username` VARCHAR( 30 ) NOT NULL ,
`email` VARCHAR( 80 ) NOT NULL ,
`pass` VARBINARY( 32 ) NOT NULL ,
`first_name` VARCHAR( 20 ) NOT NULL ,
`last_name` VARCHAR( 40 ) NOT NULL ,
`date_expires` DATE NOT NULL ,
`date_created` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ,
`date_modified` TIMESTAMP NOT NULL DEFAULT `0000-00-00 00:00:00` ,
PRIMARY KEY ( `id` ) ,
UNIQUE KEY `username` ( `username` ) ,
UNIQUE KEY `email` ( `email` )
) ENGINE = MYISAM DEFAULT CHARSET = utf8;
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 'member,admin) NOT NULL, username VARCHAR(30) NOT NULL,
email VARCHAR(80)' at line 3
The shared server I am using, uses 4.4. Thanks for reading. I am an absolute novice, having only been learning php/mysql for one month, so please speak in layman's terms.
You need to quote ENUM values
type ENUM( 'member' , 'admin' ) NOT NULL ,
not backtick them as you do now
Same thing for this line
`date_modified` TIMESTAMP NOT NULL DEFAULT `0000-00-00 00:00:00`
should be
`date_modified` TIMESTAMP NOT NULL DEFAULT '0000-00-00 00:00:00'
This page indicates that your ENUM values should be strings, so need to be surrounded by single quotes.
type ENUM( 'member' , 'admin' ) NOT NULL
okey fixed it here is it :)
CREATE TABLE `users` (
`id` INT UNSIGNED NOT NULL AUTO_INCREMENT ,
type ENUM( 'member' , 'admin' ) NOT NULL ,
`username` varchar(30) NOT NULL default '',
`password` varchar(255) NOT NULL default '',
`first_name` varchar (15) NOT NULL,
`last_name` varchar (30) NOT NULL,
`gender` ENUM('male', 'female') NOT NULL default 'male',
`email` varchar(50) NOT NULL default '',
`skype` varchar(50) NOT NULL default 'Not Specified',
`facebook` varchar(150) NOT NULL default 'Not Specified',
`location` varchar(100) NOT NULL default 'Not Specified',
PRIMARY KEY (`id`),
UNIQUE KEY (`email`),
KEY (`email`, `password`)
) ENGINE = MYISAM DEFAULT CHARSET = utf8;

Error #1064 in mysql [duplicate]

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;