Showing posts with label mysql. Show all posts
Showing posts with label mysql. Show all posts

Friday, October 11, 2013

Formatting Numbers in MySQL

I like SQL output to align properly for numbers, so I did some digging and came up with this:
lpad(format(seconds/60,2),9,' ')

The lpad function will pad the output from the left with whatever the 3rd argument is. In this case, I set it to ' ' (a space between quotes) for 9 characters.

The format function will round the output to the number of decimals specified. The example is set for 2 decimal places.

The "seconds/60" is obviously a math equation to convert seconds to minutes. The seconds is the data field I am formatting.

In Navicat, under Tools>Options..., I set the Grid Font (found under Appearance>Font) to DejaVu Sans Mono at 8 pt. This is nice, smooth mono-spaced font.

Friday, February 25, 2011

The Data Charmer: Advanced replication for the masses - Part I - Get...: "MySQL DBAs and developers: oil your fingers and get ready to experience a new dimension of data replication. I am pleased to announce that..."

Wednesday, September 01, 2010

A Tip for Using Navicat

If you use Groups to organize tables in Navicat, it can be cumbersome to locate a table later.

There is an option under the View menu to Flatten Object List. If you turn this on, then everything will be "ungrouped". Select it again to regroup.

Saturday, July 24, 2010

What version of MySQL am I using?
within MySQL, do:
select version();

external from MySQL do:
mysql -V