View Single Post

   
  #2 (permalink)  
Old 02-28-2008, 10:11 AM
Jerry Stuckle
 
Posts: n/a
Default Re: performance issue while using select

gaurav v bagga wrote:
> Hi All,
>
> I was wondering If there is any computational difference between:-
>
> 1) select * from tab1 where id = "1" AND
> 2) select * from tab1 where id = 1
>
> I have seen that both return the result but if I use query (1) at
> times instead of (2), will the performance go down.id is of type int.
>
> I'll appreciate if anyone explains me this.
>
> Regards
> gaurav
>


If this is an int field, the first query should be illegal. Values
surrounded by quotes are compared to text fields.

Additionally, the "1" is a non-standard extension to the ANSI SQL
standard. The standard is to use single quotes ('1'). The SQL would
not be compatible with other databases, and even MySQL will reject it if
it is set up to follow ANSI standards.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================
Reply With Quote