----- Original Message -----
From: "Pete Harlan" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, February 22, 2001 4:51
Subject: Quoting numbers? (was Re:MySQL Tables)


> > I think you'll get better results if you don't quote your numbers.
Quotes
> > should be used for text and dates (depending) but not numbers.
>
> Out of curiosity, why?

For starters, I've had problems in the past doing this - getting incorrect
results.  Remove quotes and everything worked fine.

The other is that not all databases/languages accept quotes around numbers.
It's like comparing apples and oranges.

>
> We use quotes for numbers all the time here, for consistency's sake;
> the programmer doesn't have to worry about the representation of, say,
> a salesman_id, but just reads/displays/stores it in the database.
>
> Aside from the fact that leaving them off is possible, is there a
> standards/compatibility/other reason to do so?
>
> (An example of a good reason not to use them would be if the db engine
> weren't smart enough to use an index when you say

Exactly. Not cross compatible with some databases/languages though it should
be with today's databases.

>
> select * from table_name where numeric_key = '1234'
>
> but possibly (probably?) all dbms's are that smart.)

I have used 2 diff. databases during my studies which would not accept the
above because of quotes.  Don't remember the names of the DBs but I do
remember one ran under DOS and the other under VAX/VMS.

>
> --Pete
>
> ---------------------------------------------------------------------
> 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

Reply via email to