Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I pretty format my SQL query in DBeaver?

I use DBeaver for my main IDE to query multiple databases. When I query a table, it automatically generates a long select statement with all columns in one line.

When I am making more complex queries, this gets very cumbersome to work with and read. I would like to view the select values on separate lines rather than one long string.

Is there an easy way (perhaps by using Notepad++ or Sublime Text) to break up the query (with line breaks after the commas)?

For example,

select name, address, city, state, country, zip_code, birthday, membership_type 
from customers

to

select
name,
address,
city,
state,
country,
zip_code,
birthday,
membership_type
from customers
like image 224
Albert Avatar asked Sep 26 '17 14:09

Albert


People also ask

How do you format a SQL query?

Select Edit -> SQL Formatter -> Format Current Query (or press F12). Only the current query would be formatted. -- Format Selected Query: To format a selected query(s) in set of query(s), select the query(s) to be formatted. Select Edit -> SQL Formatter -> Format Selected Query (or press Ctrl+F12).

How do I change DBeaver data format?

To change the data format settings use the option Window -> Preferences in main menu. In the Preferences dialog box go to Editors -> Data Editor -> Data Formats. Or, in the Database Navigator right-click a connection and select Edit Connection menu option.

How do I beautify a query in SQL Developer?

How do you format your SQL code in SQL Developer? You can press CTRL+F7 (on Windows) to format the SQL code in your current Code Editor window to update the formatting of the code based on any format changes you have made.

What is beautify SQL?

SQL Formatter helps to format SQL code data and it helps the developer easy to read the SQL. This tool helps uses to beautify large SELECT statements and make it easy to read.

How do I format a query in DBeaver?

Press Ctrl+Shift+F (or select Format>Format SQL in DQL Editor context menu) The query will be formated according default Sql workbench/j formatter settings. Please note, DBeaver doesn't apply custom settings of Sql workbench/j formatter kseniiaguzeeva added wait for response and removed wait for review labels on Sep 10, 2020

How do I format a query in SQL Server?

It can be found here: SQLinForm SQL Formatter and has 100+ formatting options with code folding and color formatting. There is also a free plugin available. Select a query to be formatted and Ctrl + shift + F does the work. I am using DBeaver 6.3.0

How to use sqlinform formatter in DBeaver?

The SQL Formatter for DBeaver is part of the Windows App. Download and unzip the Windows App and you are ready for DBeaver. Add into DBeaver a command line as explained below The SQLinForm SQL Formatter can be integrated as external Formatter in DBeaver

How to format SQL query in Notepad++?

there is another plugin for formatting SQL in Notepad++. It can be found here: SQLinForm SQL Formatter and has 100+ formatting options with code folding and color formatting. There is also a free plugin available. Select a query to be formatted and Ctrl + shift + F does the work. I am using DBeaver 6.3.0


1 Answers

DBeaver has a shortcut for this purpose. In SQL Editor: enter image description here

like image 173
Yurii Verbytskyi Avatar answered Oct 15 '22 06:10

Yurii Verbytskyi