Solved

mysql syntax error

Posted on 2009-06-28
5
217 Views
Last Modified: 2012-05-07
Why it is not working?

#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 'default int(1) default '0' not null , PRIMARY KEY (products_attributes_id) )' at line 10

create table products_attributes (

  products_attributes_id int(11) not null auto_increment,

  products_id int(11) default '0' not null ,

  options_id int(11) default '0' not null ,

  options_values_id int(11) default '0' not null ,

  options_values_price decimal(15,4) default '0.0000' not null ,

  price_prefix char(1) not null ,

  model varchar(64) not null ,

  products_attributes_thumbnail varchar(64) not null ,

  default int(1) default '0' not null ,

  PRIMARY KEY (products_attributes_id)

);

Open in new window

0
Comment
Question by:jack_
  • 2
  • 2
5 Comments
 
LVL 57

Expert Comment

by:Raja Jegan R
ID: 24730877
Try this one out:
create table products_attributes (

  products_attributes_id int not null auto_increment PRIMARY KEY,

  products_id int(11) default '0' not null ,

  options_id int(11) default '0' not null ,

  options_values_id int(11) default '0' not null ,

  options_values_price decimal(15,4) default '0.0000' not null ,

  price_prefix char(1) not null ,

  model varchar(64) not null ,

  products_attributes_thumbnail varchar(64) not null ,

  default int(1) default '0' not null

);

Open in new window

0
 
LVL 57

Expert Comment

by:Raja Jegan R
ID: 24730886
Ignore the one above:
create table products_attributes (

  products_attributes_id int(11) not null auto_increment PRIMARY KEY,

  products_id int(11) default '0' not null ,

  options_id int(11) default '0' not null ,

  options_values_id int(11) default '0' not null ,

  options_values_price decimal(15,4) default '0.0000' not null ,

  price_prefix char(1) not null ,

  model varchar(64) not null ,

  products_attributes_thumbnail varchar(64) not null ,

  default int(1) default '0' not null

);

Open in new window

0
 
LVL 28

Accepted Solution

by:
gamebits earned 500 total points
ID: 24730889
default is a reserved word, enclose it between backtick`

`default` int(1) default '0' not null ,
0
 
LVL 3

Author Comment

by:jack_
ID: 24730929
Great thanks gamebits
0
 
LVL 28

Expert Comment

by:gamebits
ID: 24730976
Thanks for the points and grade.
0

Featured Post

Zoho SalesIQ

Hassle-free live chat software re-imagined for business growth. 2 users, always free.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

If you have heard of RFC822 date formats, they can be quite a challenge in SQL Server. RFC822 is an Internet standard format for email message headers, including all dates within those headers. The RFC822 protocols are available in detail at:   ht…
Password hashing is better than message digests or encryption, and you should be using it instead of message digests or encryption.  Find out why and how in this article, which supplements the original article on PHP Client Registration, Login, Logo…
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …
In this video I am going to show you how to back up and restore Office 365 mailboxes using CodeTwo Backup for Office 365. Learn more about the tool used in this video here: http://www.codetwo.com/backup-for-office-365/ (http://www.codetwo.com/ba…

863 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now