Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

mysql syntax error

Posted on 2009-06-28
5
Medium Priority
?
231 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_
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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 2000 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

Learn Veeam advantages over legacy backup

Every day, more and more legacy backup customers switch to Veeam. Technologies designed for the client-server era cannot restore any IT service running in the hybrid cloud within seconds. Learn top Veeam advantages over legacy backup and get Veeam for the price of your renewal

Question has a verified solution.

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

By, Vadim Tkachenko. In this article we’ll look at ClickHouse on its one year anniversary.
In this blog, we’ll look at how improvements to Percona XtraDB Cluster improved IST performance.
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…
Suggested Courses

636 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