Auto Format SQL Query
Auto format a SQL query in the Arctype SQL editor.
Arctype’s SQL Editor includes an auto-formatting feature to instantly beautify queries that are hard to interpret and modify. As an example, we’ll use a query that lists all countries for which the capital and largest city are the same:
select country.Name, country.Population, bigcity.Name, bigcity.Population, concat(round(bigcity.Population / country.Population * 100,1),'%') as pct_total_pop from country, lateral (select city.Name, city.ID, city.Population from city where city.CountryCode = country.Code order by city.Population desc limit 1) as bigcity where bigcity.ID = country.Capital order by bigcity.Population / country.Population desc
There are two ways to apply formatting to a query—through the query editor context menu and using keyboard shortcuts.
The auto-formatting feature can be found in the query editor context menu. Simply right-click anywhere inside the editor window and select
Right click or press cmd/ctrl + alt/option + f to format a query
Queries can also be auto-formatted using the keyboard shortcut
cmd/ctrl + alt/option + fwhile the query editor is selected:
Format a long query in Arctype correctly