|
|
|
#1 |
|
Messages: n/a
Hébergeur: |
I've come accross queries like this one previously but never got the
time to carefully study them form some book. SELECT 1 WHERE 1 = 1 1) What do queries like these mean? From common sense, I can deduce that it is some kind of a test for a boolean value, but the result is already deterministic in the above case (true). What use is such a query for? 2) I tried the query on mySQL 4.1 and it doesn't work. Raises a syntax error. Are they specific to some dialect of SQL? 3) What dialect (T-SQL/ANSI SQL/PL/SQL) of SQL does mySQL use? |
|
|
|
#2 |
|
Messages: n/a
Hébergeur: |
Mukesh_Singh_Nick@yahoo.com wrote:
> I've come accross queries like this one previously but never got the > time to carefully study them form some book. > > SELECT 1 WHERE 1 = 1 This ain't really working in mysql, but "SELECT 1" does and it's the same. > 1) What do queries like these mean? From common sense, I can deduce > that it is some kind of a test for a boolean value, but the result is > already deterministic in the above case (true). Yes, 1=1 is always true and selecting 1 will then always been done. > What use is such a query for? It's more suited to test if the database connection is still working. > 2) I tried the query on mySQL 4.1 and it doesn't work. Raises a syntax > error. Are they specific to some dialect of SQL? There are always some tricks in each database and sometimes it may not be that useful. > 3) What dialect (T-SQL/ANSI SQL/PL/SQL) of SQL does mySQL use? MySQL -- //Aho |
|
|
|
#3 |
|
Messages: n/a
Hébergeur: |
== Quote from Mukesh_Singh_Nick ( Mukesh_Singh_Nick@yahoo.com)'s article
> I've come accross queries like this one previously but never got the > time to carefully study them form some book. > SELECT 1 WHERE 1 = 1 > 1) What do queries like these mean? From common sense, I can deduce > that it is some kind of a test for a boolean value, but the result is > already deterministic in the above case (true). > What use is such a query for? > 2) I tried the query on mySQL 4.1 and it doesn't work. Raises a syntax > error. Are they specific to some dialect of SQL? > 3) What dialect (T-SQL/ANSI SQL/PL/SQL) of SQL does mySQL use? to answer your last question, MySQL uses ANSI SQL, any scripts written in ansi will work in MySQL. there are some extra commands within MySQL that are unique to it though. -- POST BY: lark with PHP News Reader |
|
![]() |
| Outils de la discussion | |
|
|