New feature: Reformat SQL

ansgar's profile image ansgar posted 15 years ago in News Permalink
We've all been there: Getting some totally unreadable portion of SQL queries from someone else's code, and you are hard working to find the logic in order to understand it. Now, HeidiSQL can reformat such SQL, so it gets readable again. Just press the relevant button on the main toolbar:


Example code, before reformatting:
select * # select
from bla join bla on b=1 left
join blub on /* big comment select */ b.ud = udfu
where biuaosdi=1 and concat(  a , 'das'   ) like date_sub(now(), interval 1 day)
order   ' concat () ' # select
by rand() group by askdhja limit   10,     199


... and after reformatting:
SELECT * # select
FROM bla
JOIN bla ON b=1
LEFT JOIN blub ON /* big comment select */ b.ud = udfu
WHERE biuaosdi=1 AND CONCAT(a, 'das') LIKE DATE_SUB(NOW(), INTERVAL 1 DAY)
ORDER ' concat () ' # select
BY RAND()
GROUP BY askdhja
LIMIT 10, 199
1 attachment(s):
  • reflow-button

Please login to leave a reply, or register at first.