Newbie trying to create a table
Date: 07/10/06
(MySQL Communtiy) Keywords: mysql, software, database, sql, web
I'm trying to create a database to record all the ENV variables for website visits. I haven't used mysql before, though I have a good deal of experience with MS Access and DB2, so I feel confident when working with SQL.
I created a database called sitetrack, connected to it with:
use sitetrack;
and tried creating a table with the following statement:
CREATE TABLE sitetrack(
VISIT_DATE DATETIME,
QUERY_STRING VARCHAR,
SERVER_ADDR VARCHAR,
HTTP_ACCEPT_LANGUAGE VARCHAR,
SERVER_PROTOCOL VARCHAR,
TZ VARCHAR,
HTTP_CONNECTION VARCHAR,
HTTP_REFERER VARCHAR,
REMOTE_PORT VARCHAR,
HTTP_USER_AGENT VARCHAR,
HTTP_ACCEPT VARCHAR,
GATEWAY_INTERFACE VARCHAR,
HTTP_HOST VARCHAR,
SERVER_SOFTWARE VARCHAR,
SERVER_ADMIN VARCHAR,
REMOTE_ADDR VARCHAR,
SCRIPT_NAME VARCHAR,
SERVER_NAME VARCHAR,
HTTP_ACCEPT_ENCODING VARCHAR,
DOCUMENT_ROOT VARCHAR,
REQUEST_URI VARCHAR,
HTTP_ACCEPT_CHARSET VARCHAR,
REQUEST_METHOD VARCHAR,
SCRIPT_FILENAME VARCHAR,
HTTP_KEEP_ALIVE VARCHAR,
PATH VARCHAR,
SERVER_PORT VARCHAR);
When I do this I get the following error:
ERROR 1064 (42000): 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 '
SERVER_ADDR VARCHAR,
HTTP_ACCEPT_LANGUAGE VARCHAR,
SERVER_PROTOCOL VARCHAR,
TZ ' at line 3
It looks to me that there's something wrong with the "SERVER_ADDR VARCHAR," line, but I can't see what. I don't see SERVER_ADDR listed in the reserved words on any document I've come across. Could someone offer any advice or direct me to documentation that would help me figure this out?
Source: http://community.livejournal.com/mysql/99714.html