RE: Formatting Numbers with commas

2012-02-12 Thread Simon Griffiths
Please see 

http://dev.mysql.com/doc/refman/5.1/en/string-functions.html#function_format

Regards,

Simon Griffiths

-Original Message-
From: Mike Blezien [mailto:mick...@frontiernet.net] 
Sent: 12 February 2012 16:00
To: MySQL List
Subject: Formatting Numbers with commas

Hello,

Is there a function to automatically format long numercial values before
it's entered into the table, i.e I have a value like 159600 and would be
entered as
159,600 or 78450 would be entered 78,450 etc., ?

Thank you,
Mike(mickalo)Blezien
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Thunder Rain Internet Publishing
Custom Programming  Web Hosting Services
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- 


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


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



Re: Formatting Numbers with commas

2012-02-12 Thread Mike Blezien
Thank you Simon exactly what I was looking for. Appreciate the assistance.


Mike(mickalo)Blezien
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Thunder Rain Internet Publishing
Custom Programming  Web Hosting Services
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  - Original Message - 
  From: Simon Griffiths 
  To: 'Mike Blezien' ; 'MySQL List' 
  Sent: Sunday, February 12, 2012 10:26 AM
  Subject: RE: Formatting Numbers with commas


  Please see 

  http://dev.mysql.com/doc/refman/5.1/en/string-functions.html#function_format

  Regards,

  Simon Griffiths

  -Original Message-
  From: Mike Blezien [mailto:mick...@frontiernet.net] 
  Sent: 12 February 2012 16:00
  To: MySQL List
  Subject: Formatting Numbers with commas

  Hello,

  Is there a function to automatically format long numercial values before
  it's entered into the table, i.e I have a value like 159600 and would be
  entered as
  159,600 or 78450 would be entered 78,450 etc., ?

  Thank you,
  Mike(mickalo)Blezien
  =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  Thunder Rain Internet Publishing
  Custom Programming  Web Hosting Services
  -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- 


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



Re: Formatting Numbers with commas

2012-02-12 Thread Reindl Harald
Am 12.02.2012 16:59, schrieb Mike Blezien:
 Hello,
 
 Is there a function to automatically format long numercial values before it's 
 entered into the table, i.e I have a
 value like 159600 and would be entered as 159,600 or 78450 would be entered 
 78,450 etc., ?

you do not really want to destroy data this way
if you have numbers store them untouched as numbers
format them in the output however you want

if you do not mess up your data you can change the
output format to whatever you want in the future!



signature.asc
Description: OpenPGP digital signature


Re: Indexed Query examining too many rows!

2012-02-12 Thread Reindl Harald


Am 12.02.2012 23:25, schrieb Cabbar Duzayak:
 Hi All,
 
 I have a table with a btree index on its searchKey column, and when I
 send a simple query on this table:
 
 explain select * from DataIndex where (searchKey like 'A%') order by
 searchKey limit 10
 
 rows is returning 59548 and it tells me that it is using the searchKey index.
 
 Also, a select count(*) on this table returns 32104 rows, i.e.
 
 select count(*) from DataIndex where searchKey like 'a%' - gives
 32104 as its result
 
 Am I doing something wrong here? Given that the searched column is
 indexed, shouldn't it examine way less rows?

LIKE does not benefit from keys!



signature.asc
Description: OpenPGP digital signature


Re: Indexed Query examining too many rows!

2012-02-12 Thread Peter Brawley

On 2/12/2012 4:40 PM, Reindl Harald wrote:

Am 12.02.2012 23:25, schrieb Cabbar Duzayak:

Hi All,

I have a table with a btree index on its searchKey column, and when I
send a simple query on this table:

explain select * from DataIndex where (searchKey like 'A%') order by
searchKey limit 10

rows is returning 59548 and it tells me that it is using the searchKey index.

Also, a select count(*) on this table returns 32104 rows, i.e.

select count(*) from DataIndex where searchKey like 'a%' -  gives
32104 as its result

Am I doing something wrong here? Given that the searched column is
indexed, shouldn't it examine way less rows?

LIKE does not benefit from keys!


It does if the wildcard is not at the front, as indicated at 
http://dev.mysql.com/tech-resources/presentations/presentation-oscon2000-2719/ 
...


*When MySQL uses indexes*
...
When you use a LIKE that doesn't start with a wildcard.
SELECT * FROM table_name WHERE key_part1 LIKE 'jani%'
...

PB

-