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 > MYSQL Create Table Syntax

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 06-18-09, 11:54
Schweppesale Schweppesale is offline
Registered User
 
Join Date: Jun 2009
Posts: 33
MYSQL Create Table Syntax

can someone point out what's wrong with the following syntax?
Code:
DROP TABLE IF EXISTS `jos_keyword_stats`;
 
CREATE TABLE `jos_keyword_stats` (
  `Keyword` text,
  `Date` date NOT NULL,
  'Time' time,
  'Destination' mediumtext,
  'Location' mediumtext,
  'UserIP' text,
  'UserAgent' text,
  'id' int(11) NOT NULL auto_increment,
  PRIMARY KEY  (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=0 DEFAULT CHARSET=utf8;
thanks
Reply With Quote
  #2 (permalink)  
Old 06-18-09, 12:15
r937 r937 is offline
SQL Consultant
 
Join Date: Apr 2002
Location: Toronto, Canada
Posts: 19,534
try it like this --
Code:
CREATE TABLE jos_keyword_stats 
( id INTEGER NOT NULL PRIMARY KEY AUTO_INCREMENT 
, Keyword      VARCHAR(99) NOT NULL
, MyDateTime   DATETIME    NOT NULL
, Destination  VARCHAR(99)
, Location     VARCHAR(99)
, UserIP       VARCHAR(15)
, UserAgent    VARCHAR(99)
) ENGINE=MyISAM AUTO_INCREMENT=0 DEFAULT CHARSET=utf8;
your problem was that you had several strings in there (delimited by single quotes) instead of column names (optionally delimited by backticks)

i've also made some suggested improvements
__________________
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