Re: Syntax diagram, where is it located in the doc?

2005-02-04 Thread Alec . Cawley
Thomas Sundberg [EMAIL PROTECTED] wrote on 04/02/2005 
11:39:12:

 Hi!
 
 I'm looking for the syntax diagram for MySQL and can't find it. I have
 downloaded the entire MySQL manual as one html  page and searched it for 
the
 definition of where_definition and I cant find it. Could somebody please
 point me to a location where the complete syntax diagram can be found?
 
 Does anybody at the list know the answer to my question? I sent it a few
 days ago and haven't received any response. It does exist a syntax 
diagram
 for MySQL, doesn't it?

Since no-one replied to your first post, apparently not. I have never seen 
such a thing.

Alec Cawley


-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]



RE: Syntax diagram, where is it located in the doc?

2005-02-04 Thread Thomas Sundberg

 -Original Message-
 From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] 
 Sent: den 4 februari 2005 12:45
 To: [EMAIL PROTECTED]
 Cc: mysql@lists.mysql.com
 Subject: Re: Syntax diagram, where is it located in the doc?
 
 Thomas Sundberg [EMAIL PROTECTED] wrote 
 on 04/02/2005
 11:39:12:
 
  Hi!
  
  I'm looking for the syntax diagram for MySQL and can't find 
 it. I have 
  downloaded the entire MySQL manual as one html  page and 
 searched it 
  for
 the
  definition of where_definition and I cant find it. Could somebody 
  please point me to a location where the complete syntax 
 diagram can be found?
  
  Does anybody at the list know the answer to my question? I 
 sent it a 
  few days ago and haven't received any response. It does 
 exist a syntax
 diagram
  for MySQL, doesn't it?
 
 Since no-one replied to your first post, apparently not. I 
 have never seen such a thing.

Strange, where is the definition for the syntax element where_definition
done then? That is the part of the syntax diagram I currently looking for.
It is defined as an element in the select syntax diagram. But when trying to
find the definition for what is legal to put in a where clause, I just can't
find it.

Could somebody point in me the correct direction?

/Thomas


-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]



Re: Syntax diagram, where is it located in the doc?

2005-02-04 Thread Michael Stassen
From the manual, where_definition consists of the keyword WHERE followed 
by  an expression that indicates the condition or conditions that rows must 
satisfy to be selected. http://dev.mysql.com/doc/mysql/en/select.html

That seems simple and straightforward to me.  Perhaps if you told us why you 
need this, someone could provide you with the answer you need.

Michael
Thomas Sundberg wrote:
-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] 
Sent: den 4 februari 2005 12:45
To: [EMAIL PROTECTED]
Cc: mysql@lists.mysql.com
Subject: Re: Syntax diagram, where is it located in the doc?

Thomas Sundberg [EMAIL PROTECTED] wrote 
on 04/02/2005
11:39:12:


Hi!
I'm looking for the syntax diagram for MySQL and can't find 
it. I have 

downloaded the entire MySQL manual as one html  page and 
searched it 

for
the
definition of where_definition and I cant find it. Could somebody 
please point me to a location where the complete syntax 
diagram can be found?
Does anybody at the list know the answer to my question? I 
sent it a 

few days ago and haven't received any response. It does 
exist a syntax
diagram
for MySQL, doesn't it?
Since no-one replied to your first post, apparently not. I 
have never seen such a thing.

Strange, where is the definition for the syntax element where_definition
done then? That is the part of the syntax diagram I currently looking for.
It is defined as an element in the select syntax diagram. But when trying to
find the definition for what is legal to put in a where clause, I just can't
find it.
Could somebody point in me the correct direction?
/Thomas

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]


RE: Syntax diagram, where is it located in the doc?

2005-02-04 Thread Alec . Cawley
Thomas Sundberg [EMAIL PROTECTED] wrote on 04/02/2005 
12:46:02:

 

   Does anybody at the list know the answer to my question? I 
  sent it a 
   few days ago and haven't received any response. It does 
  exist a syntax
  diagram
   for MySQL, doesn't it?
  
  Since no-one replied to your first post, apparently not. I 
  have never seen such a thing.
 
 Strange, where is the definition for the syntax element 
where_definition
 done then? That is the part of the syntax diagram I currently looking 
for.
 It is defined as an element in the select syntax diagram. But when 
trying to
 find the definition for what is legal to put in a where clause, I just 
can't
 find it.
 
 Could somebody point in me the correct direction?

The WHERE keyword is followed by an expression. There appears to be no 
no formal definition of expression, but it could be informally defined 
as the a combination of Operatiors applied to column names and constants. 
See manual chapter 12: Operators. The WHERE clause restricts to rows where 
the expression returns true.

Alec Cawley.


-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]



RE: Syntax diagram, where is it located in the doc?

2005-02-04 Thread Thomas Sundberg

 -Original Message-
 From: Michael Stassen [mailto:[EMAIL PROTECTED] 
 Sent: den 4 februari 2005 14:19
 To: Thomas Sundberg
 Cc: mysql@lists.mysql.com
 Subject: Re: Syntax diagram, where is it located in the doc?
 
  From the manual, where_definition consists of the keyword 
 WHERE followed by  an expression that indicates the condition 
 or conditions that rows must satisfy to be selected. 
 http://dev.mysql.com/doc/mysql/en/select.html
 
 That seems simple and straightforward to me.  Perhaps if you 
 told us why you need this, someone could provide you with the 
 answer you need.

It is very simple but absolutely not straight forward. It really doesn't say
anything. Just that you should do things right and then you will not have
any problems.
The concrete problem I tried to solve were if MySQL supports xor in a where
clause. And if so, how should the syntax be written? That would have been
extremely simple if the syntax diagram started just above the quote you
supplied us with had been completed and not ended when things got a bit
interesting.

/Thomas


-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]



RE: Syntax diagram, where is it located in the doc?

2005-02-04 Thread Tom Crimmins


 -Original Message-
 From: Thomas Sundberg  Sent: Friday, February 04, 2005 07:48
 To: mysql@lists.mysql.com
 
 
  -Original Message-
  From: Michael Stassen   Sent: den 4 februari 2005 14:19
  To: Thomas Sundberg
  Cc: mysql@lists.mysql.com
  
   From the manual, where_definition consists of the keyword 
  WHERE followed by  an expression that indicates the condition 
  or conditions that rows must satisfy to be selected. 
  http://dev.mysql.com/doc/mysql/en/select.html
  
  That seems simple and straightforward to me.  Perhaps if you 
  told us why you need this, someone could provide you with the 
  answer you need.
 
 It is very simple but absolutely not straight forward. It 
 really doesn't say
 anything. Just that you should do things right and then you 
 will not have
 any problems.
 The concrete problem I tried to solve were if MySQL supports 
 xor in a where
 clause. And if so, how should the syntax be written? That

Yes, you can use XOR in the where clause.

SELECT * FROM mytable WHERE col1 XOR col2;

This is not a bitwise XOR, it evaluates each column to true or false first
then evals the XOR.

example for an int column:

a | b | eval

0 | 0 | false
1 | 0 | true
1 | 1 | false
-1| 12| false 
12| 0 | true
 
 would have been
 extremely simple if the syntax diagram started just above the 
 quote you
 supplied us with had been completed and not ended when things 
 got a bit
 interesting.
 
 /Thomas

---
Tom Crimmins
Interface Specialist
Pottawattamie County, Iowa

 

-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]



RE: Syntax diagram, where is it located in the doc?

2005-02-04 Thread Alec . Cawley
Thomas Sundberg [EMAIL PROTECTED] wrote on 04/02/2005 
13:48:03:

 It is very simple but absolutely not straight forward. It really doesn't 
say
 anything. Just that you should do things right and then you will not 
have
 any problems.
 The concrete problem I tried to solve were if MySQL supports xor in a 
where
 clause. And if so, how should the syntax be written? That would have 
been
 extremely simple if the syntax diagram started just above the quote you
 supplied us with had been completed and not ended when things got a bit
 interesting.

It would probably not have been very hepful because it would simply have 
mentioned operators and referred you back to section 12 of the manual 
for a complete (and growing) list of operators. Good database practice 
suggests that the same data - the list of valid operators - should not be 
in two places unless there is an aoutomated method of deriveing the lesser 
from the greater.. The master copy is the list of operators in the 
Syntax section of the manual. Since operators includes words like IN, AND, 
NOT, the syntax of operators is roughly [non-space-character]* . If you 
looked in the manuel, under operators, then bitwise operators, you would 
find xor near the top of the table - togehter with the information (not 
available in a syntax diagram) that it is only available since 4.0.2.

Alternatively , a second's experimentation (SELECT 5^1;) would have shown 
that it has the obvious syntax - or the alternative syntax (SELECT 5 XOR 
1;) ;

Alec Cawley


-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]



Re: Syntax diagram, where is it located in the doc?

2005-02-04 Thread Gleb Paharenko
Hello.



May be it is not exactly what you want, but usually, I look at

the sql/sql_yacc.yy in a source distribution.





Thomas Sundberg [EMAIL PROTECTED] wrote:

 Hi!

 

 I'm looking for the syntax diagram for MySQL and can't find it. I have

 downloaded the entire MySQL manual as one html page and searched it for the

 definition of where_definition and I cant find it. Could somebody please

 point me to a location where the complete syntax diagram can be found?

 

 /Thomas

 

 



-- 
For technical support contracts, goto https://order.mysql.com/?ref=ensita
This email is sponsored by Ensita.NET http://www.ensita.net/
   __  ___ ___   __
  /  |/  /_ __/ __/ __ \/ /Gleb Paharenko
 / /|_/ / // /\ \/ /_/ / /__   [EMAIL PROTECTED]
/_/  /_/\_, /___/\___\_\___/   MySQL AB / Ensita.NET
   ___/   www.mysql.com




-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]



Re: Syntax diagram, where is it located in the doc?

2005-02-04 Thread Peter Brawley




Thomas,

As you've discovered, MySQL documentation doesn't (yet) include a
syntax diagram, but there's a manual page for WHERE clauses, there's a
manual page for logical operators including XOR, and they show that the
answer to your question about WHERE clauses using XOR is 'yes', as does
writing the simplest possible toy query on a test table. MySQL is open
source. Perhaps you'll be the one to write the syntax diagram?

PB

-

Thomas Sundberg wrote:

  
-Original Message-
From: Michael Stassen [mailto:[EMAIL PROTECTED]] 
Sent: den 4 februari 2005 14:19
To: Thomas Sundberg
Cc: mysql@lists.mysql.com
Subject: Re: Syntax diagram, where is it located in the doc?

 From the manual, "where_definition consists of the keyword 
WHERE followed by  an _expression_ that indicates the condition 
or conditions that rows must satisfy to be selected." 
http://dev.mysql.com/doc/mysql/en/select.html

That seems simple and straightforward to me.  Perhaps if you 
told us why you need this, someone could provide you with the 
answer you need.

  
  
It is very simple but absolutely not straight forward. It really doesn't say
anything. Just that you should do things right and then you will not have
any problems.
The concrete problem I tried to solve were if MySQL supports xor in a where
clause. And if so, how should the syntax be written? That would have been
extremely simple if the syntax diagram started just above the quote you
supplied us with had been completed and not ended when things got a bit
interesting.

/Thomas


  



No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.300 / Virus Database: 265.8.5 - Release Date: 2/3/2005

-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]

Re: Syntax diagram, where is it located in the doc?

2005-02-04 Thread Jeremy Cole
Hi Thomas,
I'm looking for the syntax diagram for MySQL and can't find it. I have
Just to give you a complete answer to your question, this is what is 
valid (I've stripped out the C code parts to leave just the definition):

where_clause:
/* empty */
| WHERE expr
expr:   expr_expr
| simple_expr
expr_expr:
expr IN_SYM '(' expr_list ')'
| expr NOT IN_SYM '(' expr_list ')'
| expr BETWEEN_SYM no_and_expr AND expr
| expr NOT BETWEEN_SYM no_and_expr AND expr
| expr OR_OR_CONCAT expr
| expr OR expr
| expr XOR expr
| expr AND expr
| expr LIKE simple_expr opt_escape
| expr NOT LIKE simple_expr opt_escape
| expr REGEXP expr
| expr NOT REGEXP expr
| expr IS NULL_SYM
| expr IS NOT NULL_SYM
| expr EQ expr
| expr EQUAL_SYM expr
| expr GE expr
| expr GT_SYM expr
| expr LE expr
| expr LT expr
| expr NE expr
| expr SHIFT_LEFT expr
| expr SHIFT_RIGHT expr
| expr '+' expr
| expr '-' expr
| expr '*' expr
| expr '/' expr
| expr '|' expr
| expr '^' expr
| expr '' expr
| expr '%' expr
| expr '+' INTERVAL_SYM expr interval
| expr '-' INTERVAL_SYM expr interval
simple_expr:
simple_ident
| literal
| '@' ident_or_text SET_VAR expr
| '@' ident_or_text
| '@' '@' opt_var_ident_type ident_or_text
| sum_expr
| '-' expr %prec NEG
| '~' expr %prec NEG
| NOT expr %prec NEG
| '!' expr %prec NEG
| '(' expr ')'
| '{' ident expr '}'
| MATCH ident_list_arg AGAINST '(' expr ')'
| MATCH ident_list_arg AGAINST '(' expr IN_SYM BOOLEAN_SYM 
MODE_SYM ')'
| BINARY expr %prec NEG

Maybe this is more along the lines of what you're looking for...
snip all of the random functions
Regards,
Jeremy
--
Jeremy Cole
Technical Yahoo - MySQL (Database) Geek
--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]