Creating a Query Visually

This topic explains how to create and edit an SQL query using the Query Builder features.

We are going to create a sample query using visual designer. We will use the sakila database and display all the films stored in the sakila database, that were released after 2004.

To create a query visually:

  1. Create a server connection.

  2. On the Start page click New Query. Now, you can drag-and-drop tables from Database Explorer to the editor. Holding Ctrl, select the category, film, and film_category tables in Database Explorer, and drag-and-drop them over to the visual editor.

    dragTables

  3. Select the film_id and title check boxes in the film table, and the name check box in the category table.

    SelectChrckboxes

Actually, our query is ready to be executed. However, we need to add the WHERE condition, to display the films that were released after 2004.

  1. Go to the Where tab to insert the condition. Click the green plus icon.

    Adding a condition

  2. Click enter value.

    Entering a value

  3. Select release_year from the list.

    release year

  4. Click the equals sign and select greater than instead.

    greater than

  5. Click enter a value and type 2004.

2004

  1. Click Execute. The result set displays the information we have requested.

result

Visual Query Builder is a powerful tool that allows you to build complex queries quickly and with no code typing.