Constructing a query is a matter of a few simple steps. We will take you through each step explaining what to do. We will also explain why each step is needed. For a sample query, let us try to retrieve the first and last name of every employee.
The actual SQL syntax that is required to achieve the desired results is shown here.
select FRSTNAME, LASTNAME from EMPLOY
Here are the tasks to create your first query.
When you first display the query window, the first tab displays a tree of the tables, and views that are available. To add a table into your query, double click on that table name.
Your query will now access data from the table you selected. You can get data from multiple tables and join them all together or just work with the one table. We'll just use one table in this introduction.
Next you can choose which columns in that table you wish to see or work with. Double click on the columns you wish to examine and they will be added to the "data items list " at the bottom of this window. The data items section gives you access to many powerful capabilities of SQL. By default each item added indicates a column that will be displayed in the results of the query you are building. For our example we'll pick the two columns of the table that we want to see.
Impressive! You already have a complete valid query which will show you the first and last names of all employees.
Note that the Results tab is now available. This will allow you to run the query and see the actual results of this query.
Switch to the Results tab and the query will automatically be executed to get a fresh set of results.
Congratulations! A simple query created and executed with just a few mouse clicks. Visit the "Three minute tour" for a more an example of how to create a more complex version of this query.
SQL experts might want to try the SQL tab where the SQL can be directly edited.