Re: help on mysql tables

2001-03-30 Thread Adrian D'Costa

-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

What are the results you expect.  There are always workarounds

Adrian

On Fri, 30 Mar 2001, Ramasamy Palaniappan wrote:

 Sir,
 
 created the following tables as primary and secondary
 
 primary : partycode(primary key),partyname
 
 secondary : partycode(references to primary),companyname
 
 select partycode,companyname from secondary where partycode=(select
 partycode from primary where partyname="");
 
 as per mysql - the above query returns the syntax error.
 
 please send the correct syntax and also the below query
 
 select partycode,companyname from secondary where partycode='select
 partycode from primary where partyname=""';
 
 if we try to execute the above code, it returns an empty set even if the 
 values are there in the table.
 
 I am expecting the reply sir.
 
 regards
 
 palani
 
 _
 Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com.
 
 
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.0.2 (GNU/Linux)
Comment: For info see http://www.gnupg.org

iD8DBQE6xYov/f1mUNueu/oRArvuAKCDVWBl1pm9xlRbzsOKnV3C9C90QQCaApCE
nUJ7VOTiTtjYbaNmd8gwrtQ=
=xL3I
-END PGP SIGNATURE-


-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




help on mysql tables

2001-03-29 Thread Ramasamy Palaniappan

Sir,

created the following tables as primary and secondary

primary : partycode(primary key),partyname

secondary : partycode(references to primary),companyname

select partycode,companyname from secondary where partycode=(select
partycode from primary where partyname="");

as per mysql - the above query returns the syntax error.

please send the correct syntax and also the below query

select partycode,companyname from secondary where partycode='select
partycode from primary where partyname=""';

if we try to execute the above code, it returns an empty set even if the 
values are there in the table.

I am expecting the reply sir.

regards

palani

_
Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com.


-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




Re: help on mysql tables

2001-03-29 Thread Jeff Levy - [EMAIL PROTECTED]

mysql doesn't support subselects.

Jeff Levy
Software Design
Meta-Craft Creations

On Fri, 30 Mar 2001, Ramasamy Palaniappan wrote:

 Sir,

 created the following tables as primary and secondary

 primary : partycode(primary key),partyname

 secondary : partycode(references to primary),companyname

 select partycode,companyname from secondary where partycode=(select
 partycode from primary where partyname="");

 as per mysql - the above query returns the syntax error.

 please send the correct syntax and also the below query

 select partycode,companyname from secondary where partycode='select
 partycode from primary where partyname=""';

 if we try to execute the above code, it returns an empty set even if the
 values are there in the table.

 I am expecting the reply sir.

 regards

 palani

 _
 Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com.


 -
 Before posting, please check:
http://www.mysql.com/manual.php   (the manual)
http://lists.mysql.com/   (the list archive)

 To request this thread, e-mail [EMAIL PROTECTED]
 To unsubscribe, e-mail [EMAIL PROTECTED]
 Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php



-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




help on mysql tables

2001-03-27 Thread Ramasamy Palaniappan

Dear Sir,

I have created the following table:

create table test(name varchar(10) NOT NULL);

query is ok

I HAVE TRIED THE FOLLOWING QUERY :

insert into test values("");

MYSQL COMMAND IS ACCEPTING THE ABOVE QUERY WHICH VIOLATES NOT NULL 
CONSTRAINTS.

PLEASE CHECK THE ABOVE QUERY

KINDLY INFORM ME THE CORRECT SYNTAX SIR.

THANKS AND REGARDS.

Palaniappan.

_
Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com.


-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




Re: help on mysql tables

2001-03-27 Thread Ramasamy Palaniappan

Sir,

please tell me how to stop mysql from accepting empty string values.

it accepts empty string values even when i enclosed in single quotes.

pl inform me with the syntax.

rgds

palani


From: "Dennis Salguero" [EMAIL PROTECTED]
To: "Ramasamy Palaniappan" [EMAIL PROTECTED], 
[EMAIL PROTECTED]
Subject: Re: help on mysql  tables
Date: Tue, 27 Mar 2001 07:08:29 -0500

- Original Message -
From: "Ramasamy Palaniappan" [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Tuesday, March 27, 2001 6:53 AM
Subject: help on mysql tables


  I have created the following table:
 
  create table test(name varchar(10) NOT NULL);
  query is ok

Yes, but notice that you put a constraint of NOT NULL on the field. This
means that there has to be a value in this field, in every record.

  I HAVE TRIED THE FOLLOWING QUERY :
 
  insert into test values("");
 
  MYSQL COMMAND IS ACCEPTING THE ABOVE QUERY WHICH VIOLATES NOT NULL
  CONSTRAINTS.

First problem is that you should specify a table field after the table name
and you should specify a corresponding piece of data in the VALUES portion
of your statement. Next, you need to make sure that the data you enter is
NOT blank since the field has a NOT NULL constraint. Finally, you should
encase your data in single quotation marks, not double quotation marks.
Therefore, change your statement to:

INSERT INTO test(name) VALUES('something');

If your table has only one field, you can also use the statement below:

INSERT INTO test VALUES('something');

Good luck,

Dennis
**'
Beridney Computer Services
[EMAIL PROTECTED]
P: 703-566-3196
http://www.beridney.com



_
Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com.


-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




RE: help on MySQL tables

2001-03-27 Thread Cal Evans

Hi Rick,

You absolutely right, you are not required to specify field names in an
Insert.  But it's a good idea to do so.  1) It makes you code more readable
for those following you.  2) If your table ever changes structure, your
Insert will still work. (Assuming you didn't remove one or more of the
fields you are inserting into.)

Cal
http://www.calevans.com


-Original Message-
From: Rick Emery [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, March 27, 2001 1:25 PM
To: [EMAIL PROTECTED]
Subject: RE: help on mysql tables


You DO NOT need to specify table field names when INSERTing records.  For
instance, if the table were defined thus:

CREATE TABLE mytable (
  valueA varchar(10) NOT NULL,
  valueB varchar(25),
  valueC varchar(30) );

This statement will insert one record:
  INSERT INTO mytable VALUES("some text", "more text", "last text");

To insert multiple records, go with:
  INSERT INTO mytable VALUES("some text", "more text", "last text"),("record
2","text for 2","last text in 2");
- Original Message -
From: "Ramasamy Palaniappan" [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Tuesday, March 27, 2001 6:53 AM
Subject: help on mysql tables


 I have created the following table:

 create table test(name varchar(10) NOT NULL);
 query is ok

Yes, but notice that you put a constraint of NOT NULL on the field. This
means that there has to be a value in this field, in every record.

 I HAVE TRIED THE FOLLOWING QUERY :

 insert into test values("");

 MYSQL COMMAND IS ACCEPTING THE ABOVE QUERY WHICH VIOLATES NOT NULL
 CONSTRAINTS.

First problem is that you should specify a table field after the table name
and you should specify a corresponding piece of data in the VALUES portion
of your statement. Next, you need to make sure that the data you enter is
NOT blank since the field has a NOT NULL constraint. Finally, you should
encase your data in single quotation marks, not double quotation marks.
Therefore, change your statement to:

INSERT INTO test(name) VALUES('something');

If your table has only one field, you can also use the statement below:

INSERT INTO test VALUES('something');

Good luck,

Dennis
**'
Beridney Computer Services
[EMAIL PROTECTED]
P: 703-566-3196
http://www.beridney.com



-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php



-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php