If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > MySQL > Newbie Problems (mostly syntax errors)

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 04-19-10, 22:24
gymangel812 gymangel812 is offline
Registered User
 
Join Date: Apr 2010
Posts: 1
Newbie Problems (mostly syntax errors)

When I try to create a table I get a 1064 syntax error:
DROP TABLE IF EXISTS sandwiches;
CREATE TABLE sandwiches
(
sandwichid INT(3) NOT NULL AUTO_INCREMENT PRIMARY KEY,
sandwichname VARCHAR(20) UNSIGNED NOT NULL,
description VARCHAR(50),
image_name VARCHAR(30)
);

I also get the same error for this table:
DROP TABLE IF EXISTS origins;
CREATE TABLE origins
(
image_name VARCHAR(20) UNSIGNED NOT NULL,
origin VARCHAR(20),
price DECIMAL(5,2),
PRIMARY KEY(image_name)
);

When I change image_name to INT, it doesn't give this error but image_name needs to be VARCHAR.

Last edited by gymangel812; 04-19-10 at 22:37.
Reply With Quote
  #2 (permalink)  
Old 04-20-10, 06:52
r937 r937 is offline
SQL Consultant
 
Join Date: Apr 2002
Location: Toronto, Canada
Posts: 19,525
VARCHARs do not allow the UNSIGNED option... think about it
__________________
r937.com | rudy.ca
please visit Simply SQL and buy my book
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On