As a sql developer, DBA. we often post sql code on our blog. Take this sql for example,
select pub_name, count(qty) as orders, sum(qty) as total
from sales inner join titles on (sales.title_id=titles.title_id)
right join publishers on (publishers.pub_id=titles.pub_id)
group by pub_name
It's really difficult for others to read. and how about this one after beautify previous sql:
Count(qty) AS orders,
Sum(qty) AS total
INNER JOIN titles
ON (sales.title_id = titles.title_id)
RIGHT JOIN publishers
ON (publishers.pub_id = titles.pub_id)
GROUP BY pub_name
Yes, it's really good for your readers.
Now, you can do this instantly with the help of a free online sql formatter:
1. Paste original sql code into input sql text box, then select corresponding database type, and output type(sql(html:span) should be ok).
2. Click "format sql" button
3. Copy Html code from text box at the bottom of that page.
4. In your FCKeditor(If you're using SUBTEXT which is used by sqlteam weblogs), switch to source code mode by click "source code icon" in the up-left corner,
then paste html code, after that switch back to normal mode by click that button again.
5. You are done.
I think it should as easy as this to tidy sql in other blog systems like wordpress, community server. Anyway, I will check those blogs system, and let you know the result in next following days.