LinuxQuestions.org
Go Job Hunting at the LQ Job Marketplace
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices



Reply
 
Search this Thread
Old 07-23-2005, 10:26 PM   #1
Neruocomp
Member
 
Registered: Oct 2004
Distribution: Slackware, CentOS
Posts: 135

Rep: Reputation: 15
Can't get pass this mysql syntax error


Ok so I have to tell you I'm new to mysql, but it isn't all that hard. But its when problems happen that make it difficult. I'm trying to install this software called ArrayDB from genome.gov and it is build for either sybase or oracle, none of which I want to download and install. So far I've been able to figure how how to get it work work with mysql, the place where I'm running into problems is setting up the tables. For some reason, the following doesn't want to work:
CREATE TABLE adb_intensity (
Exp_id numeric(10,0) not null ,
Cl_id numeric(10,0) not null ,
Spot_id numeric(10,0) not null ,
Top int null ,
Left int null ,
Bottom int null ,
Right int null ,
Bkg_mean_R float null ,
Bkg_mean_G float null ,
Bkg_dev_R float null ,
Bkg_dev_G float null ,
Sample_total_R float null ,
Sample_total_G float null ,
Sample_mean_R float null ,
Sample_mean_G float null ,
Sample_dev_R float null ,
Sample_dev_G float null ,
Sample_size_R int null ,
Sample_size_G int null ,
Ratio float null ,
Cal_Ratio float null ,
Conf_level float null )
;

I get a syntax error at line 6, which I guess is the "Bottom int null" line. Any ideas?
David
 
Old 07-23-2005, 11:33 PM   #2
lowpro2k3
Member
 
Registered: Oct 2003
Location: Canada
Distribution: Slackware
Posts: 340

Rep: Reputation: 30
Hmm I don't think you can use NULL on numeric column types. Try changing the word NULL to ZEROFILL (initialize automatically to 0), or if you dont want them to contain _anything_ drop the NULL keyword entirely.

Also if you try that and you still get errors, I think you might need an argument for your FLOAT types (the precision).

For a 4 digit precision float, try:

Code:
col_name FLOAT(4) ZEROFILL,
My advice is to become friendly with DROP TABLE so you can just make smaller tables and drop them to test syntax. I would break that query into a bunch of smaller queries for debugging, find what works/doesnt work, then you can rebuild the big one and build that table you want to build.
 
Old 07-23-2005, 11:55 PM   #3
Matir
Moderator
 
Registered: Nov 2004
Location: San Jose, CA
Distribution: Ubuntu
Posts: 8,507

Rep: Reputation: 118Reputation: 118
LEFT and RIGHT (case-insensitive) are reserved words in MySQL. They must either be quoted, or not used at all (preferred by MySQL).
 
Old 07-24-2005, 01:13 AM   #4
Neruocomp
Member
 
Registered: Oct 2004
Distribution: Slackware, CentOS
Posts: 135

Original Poster
Rep: Reputation: 15
Thanks, I don't think I would have found that out about left and right. Anyways, now that I have that fixed, I now have another problem.
CREATE VIEW UniGene
AS SELECT
Cc.Cl_id
, Clone
, Cl.Clust
, Title
, Cl.Flags
, Gsymb
, Cymap
, Txmap
FROM adb_clusters_clones Cc
, adb_clusters Cl
, adb_clones C
WHERE Cl.Clust = Cc.Clust
AND Cc.Cl_id = C.Cl_id
;
Now this one doesn't want to work.

I check the documentation on CREATE VIEW, but can't seem to find out whats wrong with it except that for some reason it fails at the first line,"Cc.Cl_id"
All the tables are build so I don't think its something with it trying to find something not there.

Any Ideas?
David
 
Old 07-24-2005, 06:13 PM   #5
eddiebaby1023
Member
 
Registered: May 2005
Posts: 378

Rep: Reputation: 33
Give us a clue - what's the error message?
 
Old 07-24-2005, 06:25 PM   #6
Neruocomp
Member
 
Registered: Oct 2004
Distribution: Slackware, CentOS
Posts: 135

Original Poster
Rep: Reputation: 15
ERROR 1064 (42000) at line 1: 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 'VIEW UniGene
AS SELECT
Cc.Cl_id,
Clone,
Cl.Clust,
Tit' at line 1
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
mysql error Can't connect to local MySQL server through socket '/var/lib/mysql/mysql. Dannux Linux - Software 3 03-24-2006 09:44 AM
MySQL syntax problem Hydrap Linux - Software 1 08-11-2005 11:49 PM
C++ syntax error before :: token HELP, i cant find the syntax error :( qwijibow Programming 2 12-14-2004 07:09 PM
mysql syntax question pk21 Linux - General 1 05-18-2004 07:30 AM
MySQL root pass tommytomato Linux - Newbie 0 02-02-2004 07:34 AM


All times are GMT -5. The time now is 11:16 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration