# SQL Builder tools

Users can expand the My ER Diagram Menu on the left-hand side to choose the ER Diagram and the tables to be used in the SQL query. Drag and drop the table from the left panel onto the design diagram to start building the query.

<div align="left"><img src="https://2015371994-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FMpDjHWFRUtZ5nJcSfVXd%2Fuploads%2FaQxvaYCabUHIq0GP6A5A%2Fimage.png?alt=media&#x26;token=3aa8982e-ba6b-4e2e-818d-caf4eab72c3b" alt=""></div>

<div align="left"><img src="https://2015371994-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FMpDjHWFRUtZ5nJcSfVXd%2Fuploads%2FBqWlwS44kgT8nWaR6pyt%2Fimage.png?alt=media&#x26;token=56109468-a72d-4790-9115-de4ddafb8ef4" alt=""></div>

Once the user drag and drop the table into the design panel, it will show all the columns in that table in the design panel.

Users can also see the other SQL Builder projects in their app on the side menu under My Query. Users can drag and drop another builder project to the design panel to use it as a sub query. It will show the output of that query as a table in the design panel.

![](https://2015371994-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FMpDjHWFRUtZ5nJcSfVXd%2Fuploads%2F9fmlfUNZD0szqAl5AKiP%2Fimage.png?alt=media\&token=c5efe0b0-d3fd-462b-872b-16963b1d9c66)

SQL Builder also has a configuration panel that shows the current SQL configuration which is being built

![](https://2015371994-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FMpDjHWFRUtZ5nJcSfVXd%2Fuploads%2FyKQt2m5L6M9UKf8KKvad%2Fimage.png?alt=media\&token=88847a53-c1b0-4405-9d84-167cd8a1c023)

It has the following tabs&#x20;

* Columns : Displays the field or columns that are selected from the table for running the query.&#x20;
* Union List : To configure union with another query.&#x20;
* Join List : Displays the different joins between tables in the query.
* Query : Displays the output SQL query from the builder.&#x20;
* Data : In this panel, user can execute the SQL command to get sample data if a valid connection is present.&#x20;

\
It also has the following submenu in the columns tab.&#x20;

* New ![](https://2015371994-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FMpDjHWFRUtZ5nJcSfVXd%2Fuploads%2FQT4rKe1V64GxipnYC0uK%2Fimage.png?alt=media\&token=589efe89-a126-4038-b6d2-13131572ecd4) : To generate a new concatenated column in the generated query
* Exit ![](https://2015371994-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FMpDjHWFRUtZ5nJcSfVXd%2Fuploads%2FvCpRBRm106QwUG6lHCDL%2Fimage.png?alt=media\&token=beafa316-d583-4456-a12d-cb6b3798db16) : Exit from the project&#x20;
* Save ![](https://2015371994-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FMpDjHWFRUtZ5nJcSfVXd%2Fuploads%2FXQhUcurxfSpOn9MpH9JS%2Fimage.png?alt=media\&token=f6be126d-07c0-4c04-867b-b4493d507e34) : Save project&#x20;
* Condition wizard ![](https://2015371994-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FMpDjHWFRUtZ5nJcSfVXd%2Fuploads%2FWJaAacBH84aylLp7GAYq%2Fimage.png?alt=media\&token=3635b9f5-84a6-4381-9d71-eddc14aec212) : Configure condition

**Columns Tab** \
Columns that are selected in the design panel will show in the columns tab and users can add additional configurations to them if they want.

![](https://2015371994-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FMpDjHWFRUtZ5nJcSfVXd%2Fuploads%2FoBL85iDLZdwlKZKEgIBf%2Fimage.png?alt=media\&token=742ee091-9f23-4916-a3ea-24d8c04afd2b)

If offers the following features&#x20;

* Select: Select to include the columns in the select clause or un-select as required User can also delete the column tab by clicking at icon ‘x’

![](https://2015371994-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FMpDjHWFRUtZ5nJcSfVXd%2Fuploads%2Fng3OxkgFK7tm9LJIPjVf%2Fimage.png?alt=media\&token=ea866a82-7ace-416f-bbec-fd688aee087f)

* Function: To add SQL functions to the select columns like Min, Max, Count, etc.

![](https://2015371994-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FMpDjHWFRUtZ5nJcSfVXd%2Fuploads%2FrbGjBx4BibmmIVohGpRY%2Fimage.png?alt=media\&token=7a5bd20d-248a-4762-8b21-459840358e68)

* Distinct: To set a column value as distinct in select.

![](https://2015371994-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FMpDjHWFRUtZ5nJcSfVXd%2Fuploads%2FEZtdbkCkgbcxIBUuogNk%2Fimage.png?alt=media\&token=2c0860fa-c50a-45bb-9b8a-f485064b6eb1)

* Column: To display the name of selected columns.
* Alias: To configure alias name for a select phrase.

![](https://2015371994-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FMpDjHWFRUtZ5nJcSfVXd%2Fuploads%2F0pvNpVdkPfGMKb9OHzhn%2Fimage.png?alt=media\&token=f4ffde6c-2552-4a03-8b53-07895f96bea2)

* Object: Schema Name and Table name&#x20;
* Group by: For selecting the column to be used in group by claus
* Having: For setting the condition for group\_by clauses&#x20;
* Sort: To include the column in the sort clause.&#x20;
* Sort Type: To set sort by ascending or descending.

**Union List Tab** \
When you have more than one SQL project in your application, you can join them together to form complex queries. The union tab allows users to configure the union with another SQL builder project that is selected and dragged to the design panel.

![](https://2015371994-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FMpDjHWFRUtZ5nJcSfVXd%2Fuploads%2Fo7dRyAyeZ5XIfhsBNNfo%2Fimage.png?alt=media\&token=a5f9c41e-a1ec-4ef3-860f-3c92ce8a99d1)

**Join List Tab** \
To configure the join condition for the SQL query.

**Query Tab** \
To generate the SQL query from all the configurations.

![](https://2015371994-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FMpDjHWFRUtZ5nJcSfVXd%2Fuploads%2F9bPDaAWHqzmjOb0U39Yy%2Fimage.png?alt=media\&token=b1aaca7a-9d6e-4d11-bd16-32a5b5b3a5ec)

**Data Tab** \
To execute the SQL query generated against a valid connection and view the result set from the database. The current version retrieves only the first 5 records from the result set.

![](https://2015371994-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FMpDjHWFRUtZ5nJcSfVXd%2Fuploads%2FeDDRUREadv7Rf8R6FDUt%2Fimage.png?alt=media\&token=93b7ebb8-c22d-48e3-be3a-e585b3dc24ad)

* New Concatenated column ![](https://2015371994-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FMpDjHWFRUtZ5nJcSfVXd%2Fuploads%2FQVkmCFJyYjxBmBPyYxzU%2Fimage.png?alt=media\&token=fb9c10e6-976b-4d4e-97ab-f83101767d59) . \
  To add a new column in the select clause as a concatenated string of multiple columns. Users can choose the object or table and then choose the columns that need to be concatenated.

![](https://2015371994-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FMpDjHWFRUtZ5nJcSfVXd%2Fuploads%2FqmdOZJVj9TRIr3Iw3iW9%2Fimage.png?alt=media\&token=e87f359d-9168-4b85-ba89-7f2b1c444f9b)

* Exit ![](https://2015371994-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FMpDjHWFRUtZ5nJcSfVXd%2Fuploads%2FXhdNmnInsshYnDw5geh4%2Fimage.png?alt=media\&token=3d60fa40-418f-49c1-92d2-4b2ef7c16da0)\
  To exit from the current SQL Builder project.
* Save ![](https://2015371994-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FMpDjHWFRUtZ5nJcSfVXd%2Fuploads%2Fl2EsbLaN9RmxQJFNsZ1h%2Fimage.png?alt=media\&token=5e4600ba-d571-41be-adc7-47aa06bb8c1d)\
  To save the current SQL Builder configurations.
* Condition Wizard ![](https://2015371994-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FMpDjHWFRUtZ5nJcSfVXd%2Fuploads%2F1TK1FIyZqKrXzjGGTr89%2Fimage.png?alt=media\&token=3a21d15e-f907-400d-8f9c-905e61b293f1)\
  To add condition statements to the SQL. User can add where conditions as well as group conditions.

![](https://2015371994-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FMpDjHWFRUtZ5nJcSfVXd%2Fuploads%2FXr6kZtQGNBZt1S8DWil3%2Fimage.png?alt=media\&token=c642d270-fbdb-49c4-a5b3-459ad0d183a1)

Click on the + Condition to specify the condition

![](https://2015371994-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FMpDjHWFRUtZ5nJcSfVXd%2Fuploads%2F0YbDzD7kTXwbYT5woCie%2Fimage.png?alt=media\&token=5495bea9-0ee5-4001-bb85-a3546683bc57)

![](https://2015371994-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FMpDjHWFRUtZ5nJcSfVXd%2Fuploads%2FyvP5cBDkJ0M1fOKSvety%2Fimage.png?alt=media\&token=b8aab887-1663-4834-89a4-3b7053aae916)
