Smart Query Mode

The Smart Query Mode is a very handy feature to perform select/update/delete/insert queries on a specific table. It is displayed whenever you click on a table or a view in the left hand pane.

Consider the following scenario as shown below :

As you can see, the user has selected the customer table and displayed all the rows in the table. The smart query mode is normally active and is represented by the smart query panel, as shown below :



The smart query panel allows you to work in Four Modes, represented by the radio buttons - Select, Update, Insert, Delete.

Select Mode

When the Select radio button is checked, the smart query mode will generate Select Queries. For example, let us say you want to find all rows whose m_number is greater than 10000 and only display the first_name, last_name and city columns. To do that, perform the following steps :

1) Check the boxes above the first_name, last_name and city columns.
2) Move Focus on the text field above the m_number column and type in 10000.
3) While keeping focus in the text field, press Ctrl+ > on the keyboard.

You will notice that the query is automatically generated as you perform the actions as shown in the diagram below. Once you are satisfied with the result, execute the query and you should get the appropriate results.


Update Mode

Update queries are generated when the update radio button is selected. For example, let us say that you want to update the first name of every person whose m_number is 10001 to "James". To do that, perform the following steps :

1) Check the box above the first name column.
2) Move Focus on the text field above the m_number column and type in 10001.
3) Move cursor in the data tab and replace <value> with 'James'

Execute the query when you are satisfied with the results. The diagram below demonstrates the query :


Insert Mode

The insert mode allows you to insert rows into the specified table. For example let us say that you want to insert a new customer in the customer table. In this case, you want to insert only the first_name, last_name, address, city and zip. Perform the following steps :

1) Check the boxes above the first_name, last_name, address, city and zip columns.
2) Make sure that you enter data for ALL the textfields below the check boxes.

Execute the query when you are satisfied with the results. The diagram below demonstrates the query :


Delete Mode

The delete mode works like the Select mode except the fact that it will execute the delete statement for the criteria specified. The other difference is that in delete mode, checking the boxes above the column names have no effect on the generated query. Again, for example let us say you want to delete all customers whose name is "Tom". Perform the following steps:

1) Focus in the text field above the column first_name.
2) Type in Tom

Inspect the generated query and execute it if want to delete those rows. The diagram below demonstrates the results :