Solved

mysql syntax error

Posted on 2009-06-28
5
215 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

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
SQL Query 18 80
SQL Round a percentage 2 23
How to connect to a remote mysql server using C#? 9 42
Selecting specific rows 3 34
'Between' is such a common word we rarely think about it but in SQL it has a very specific definition we should be aware of. While most database vendors will have their own unique phrases to describe it (see references at end) the concept in common …
Introduction Since I wrote the original article about Handling Date and Time in PHP and MySQL (http://www.experts-exchange.com/articles/201/Handling-Date-and-Time-in-PHP-and-MySQL.html) several years ago, it seemed like now was a good time to updat…
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…

707 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

12 Experts available now in Live!

Get 1:1 Help Now