473,385 Members | 1,782 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

trouble with query

Jay
hi people,
i am using mysql and i am having the following problem....
I know this is not the correct to ask this problem. but i am need of
help urgently thats why i posted this here.
but please help
i have a table with the following fields .when i try to enter data i get
the following error.any help would b
+---------------------------+---------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default |
Extra |
+---------------------------+---------------+------+-----+---------+-------+
| human_subj | char(3) | YES | | NULL
| |
| human_subj_approval_date | timestamp(6) | YES | | NULL
| |
| animal_subj | char(3) | YES | | NULL
| |
| animal_subj_approval_date | timestamp(6) | YES | | NULL
| |
| toxic | char(3) | YES | | NULL
| |
| toxic_approval_date | timestamp(6) | YES | | NULL
| |
| curriculum_change | char(3) | YES | | NULL
| |
| compensate_employee | char(3) | YES | | NULL
| |
| course_release | char(3) | YES | | NULL
| |
| subcontract | char(3) | YES | | NULL
| |
| sponsor_org | char(3) | YES | | NULL
| |
| additional_space | char(3) | YES | | NULL
| |
| search_waiver | char(3) | YES | | NULL
| |
| generate_income | char(3) | YES | | NULL
| |
| classified | char(3) | YES | | NULL
| |
| suspended | char(3) | YES | | NULL
| |
| institute_affected | char(3) | YES | | NULL
| |
| tution_included | char(3) | YES | | NULL
| |
| tenure | char(3) | YES | | NULL
| |
| pi_assurance | char(3) | YES | | NULL
| |
| pi_sign | char(40) | YES | | NULL
| |
| pi_date | timestamp(6) | YES | | NULL
| |
| co_pi_assurance_1 | char(3) | YES | | NULL
| |
| co_pi_sign | char(40) | YES | | NULL
| |
| co_pi_1_date | timestamp(14) | YES | | NULL
| |
| co_pi_assurance_2 | char(3) | YES | | NULL
| |
| co_pi_sign2 | char(40) | YES | | NULL
| |
| co_pi_2_date | timestamp(14) | YES | | NULL
| |
| co_pi_assurance_3 | char(3) | YES | | NULL
| |
| co_pi_sign3 | char(40) | YES | | NULL
| |
| co_pi_3_date | timestamp(14) | YES | | NULL
| |
| co_pi_assurance_4 | char(3) | YES | | NULL
| |
| co_pi_sign4 | char(40) | YES | | NULL
| |
| co_pi_4_date | timestamp(14) | YES | | NULL
| |
| proj_id | int(5) | YES | | NULL
| |
+---------------------------+---------------+------+-----+---------+-------+
35 rows in set (0.00 sec)

when i enter the following data

INSERT INTO form VALUES
('yes',,'yes',,'yes',,'yes','yes','yes','yes','yes ','yes','yes','no','yes','no','yes','yes','yes','y es','john',,'',,,'','',,'','',,'','',,'');

i get the following error
ERROR 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 ''yes',,'yes',,'yes','yes','yes','yes','yes','yes' ,'yes','no','y

please help!
thanks
jay
---------------------------(end of broadcast)---------------------------
TIP 4: Don't 'kill -9' the postmaster

Nov 23 '05 #1
1 972
On Wed, 2004-08-04 at 03:28, Jay wrote:
hi people,
i am using mysql and i am having the following problem....
I know this is not the correct to ask this problem.
Surely a MySQL mailing list could have answered this? I thought they
had good community support.
but i am need of
help urgently thats why i posted this here.
but please help
i have a table with the following fields .when i try to enter data i get
the following error.any help would b ....
when i enter the following data

INSERT INTO form VALUES
('yes',,'yes',,'yes',,'yes','yes','yes','yes','yes ','yes','yes','no','yes','no','yes','yes','yes','y es','john',,'',,,'','',,'','',,'','',,'');

i get the following error
ERROR 1064: You have an error in your SQL syntax.


Even MySQL doesn't accept that kind of thing!

You have doubled commas at several places in the VALUES list. I suppose
those are meant to be nulls - you should specify NULL instead of nothing
at all:

INSERT INTO form VALUES
('yes',NULL,'yes',NULL,'yes',NULL,'yes',...);

The way you have written it is bad practice any way. You should use
specific column names rather than relying on the current order in the
table:

INSERT INTO form (human_subj, animal_subj, toxic,...)
VALUES ('yes','yes','yes',...);

This will continue to work even if the table's column order changes for
some reason.
--
Oliver Elphick ol**@lfix.co.uk
Isle of Wight http://www.lfix.co.uk/oliver
GPG: 1024D/A54310EA 92C8 39E7 280E 3631 3F0E 1EC0 5664 7A2F A543 10EA
========================================
"And not only so, but we glory in tribulations also;
knowing that tribulation worketh patience; And
patience, experience; and experience, hope."
Romans 5:3,4
---------------------------(end of broadcast)---------------------------
TIP 5: Have you checked our extensive FAQ?

http://www.postgresql.org/docs/faqs/FAQ.html

Nov 23 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: fstenoughsnoopy | last post by:
Ok the complete story. I have a Contact Table, Query and Form, that are used to input and store the contact info for customers. They have FirstName, LastName and Address as the primary key...
0
by: harry12 | last post by:
Hello- I'm fairly new at using Microsoft Access and I'm having trouble getting a couple of things to work in my database. The first is that I have yet to find a way to get an append query to...
1
by: ferraro.joseph | last post by:
Hi, I'm querying Salesforce.com via their AJAX toolkit and outputting query results into a table. Currently, their toolkit does not possess the ability to do table joins via their structured...
11
by: kennthompson | last post by:
Trouble passing mysql table name in php. If I use an existing table name already defined everything works fine as the following script illustrates. <?php function fms_get_info() { $result =...
5
by: tschulken | last post by:
I have a query where i need to look for a value of a lower level xml element based on the value of a parent element existing first. Here is a simple example of the xml <S3Client> <Buttons>...
3
by: narpet | last post by:
Hello all... I'm having trouble with a query. Here's the situation: I have two tables, one that holds client info and another that holds invoicing info. The two tables have client number in...
1
by: =?iso-8859-1?B?RXJpYyBM83Bleg==?= | last post by:
Hello Guys! I just installed MySQL Community Server 5.0 onto my computer, which is running Red Hat 8.0 and it works fine, but I was trying to install the MySQL GUI Tools (Query Browser, MySQL...
1
by: nico3334 | last post by:
I'm having trouble with a query using "MAX". In my query I'm trying to use 2 date columns as my criteria. Here is the format for each column: Date1: 01/01/2007 Date2: 200701 For my...
3
by: lostdawg | last post by:
Hi, I am having trouble with the following query. I need to sort from a list of contacts the last date each was contacted. This is to be represented in days so for instance: 0-42 days...
1
by: George | last post by:
I have just loaded Access 2007 and am having trouble creating a new database where I update my table from a query. I have done this numerous times in years past but am totally frustrated tryng to...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.