Jump to content

[SOLVED] I should have done this sooner, please help me : CREATE TABLE


Rebelrebellious

Recommended Posts

I have tried every reconfiguration of ' ` and " marks that I could imagine. This is only the latest failed attempt. What am I doing wrong?

 

The most frequent error I have been seeing is:

 

#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 'NULL,

`letsmeetfreetimeinminutes` INT NOT NULL,

`letsmeetupdateswitch` ENUM ( ' at line 7

 

I understand this is due to a conflict with the reserved words. I would like to stick with descriptive column names if it is possible.

Maybe the problem has to to with my use of ENUM, I really don't know. Please help.

 

CREATE TABLE letsmeet_Jesse__calendar 
(
`letsmeetdate` INT( 2 ) NOT NULL,
`letsmeetmonth` ENUM( 'January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December' ) NOT NULL,
`letsmeetyear` INT NOT NULL,
`letsmeetdayname` ENUM ( 'Mon`day`', 'Tues`day`', 'Wednes`day`', 'Thurs`day`', 'Fri`day`', 'Satur`day`', 'Sun`day`' ) NOT NULL,
`letsmeeteventlist` VARCHAR NULL,
`letsmeetfreetimeinminutes` INT NOT NULL,
`letsmeetupdateswitch` ENUM ( 'onefoot', 'twofoot', 'threefoot' ) NULL,
`letsmeetupdatefootstep` INT NOT NULL,
`letsmeetprimarykey` INT NOT NULL AUTO_INCREMENT,
PRIMARY KEY( `letsmeetprimarykey` )
)

 

 

And I just read that you will want this:

 

Server version: 5.0.45-community

Protocol version: 10

Server: Localhost via UNIX socket

Link to comment
Share on other sites

I also wanted to add that the ENUM choices for the letsmeetupdateswitch column hould preferrably be simply Left or Right. If that in't possible, then I would like to use 0 or 1.

 

Also, the letsmeet prefix was somehing I added to try to get around this error. Aside from the table prefix I don't see any value in having the prefix on each of the columns. Thanks,

 

-Jesse

Link to comment
Share on other sites

varchar can have a maximum of 256 characters.  the backticks are not needed, but can be left there, is is safe for using mysql reservered words.

 

Here is a reference of lengths if needed

 

char(size)  Holds a fixed length string (can contain letters, numbers, and special characters). The fixed size is specified in parenthesis

 

varchar(size) Holds a variable length string (can contain letters, numbers, and special characters). The maximum size is specified in parenthesis

 

tinytext Holds a variable string with a maximum length of 255 characters

 

text

blob Holds a variable string with a maximum length of 65535 characters

 

mediumtext

mediumblob Holds a variable string with a maximum length of 16777215 characters

 

longtext

longblob Holds a variable string with a maximum length of 4294967295 characters

Link to comment
Share on other sites

Thank you very much. I really should have come here right away. Now I can get on with my project. :)

 

What type should I use if I want to have the option of storing really long lists of text? text files and such

 

Have a great day.

 

 

 

---update--- You must have been reading my mind.

Link to comment
Share on other sites

varchar can have a maximum of 256 characters.  the backticks are not needed, but can be left there, is is safe for using mysql reservered words.

No longer -- in MySQL5, up to 65K.

 

Ok, I will have to update my reference sheet.  Thanks for the correction.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.