SQL allows you to select specific columns from a table.
In this example, the SQL statement is:
SELECT FIRSTNAME, LASTNAME, HIREDATE FROM PJDATA.EMPLOYEE
This SQL query is selecting individual columns in the EMPLOYEE table. LASTNAME, FIRSTNAME and HIREDATE are
the names of specific columns. Selecting specific columns will prevent you from displaying data that isn't relevant
to the search. Each column name is separated by a comma. Again notice the FROM keyword pointing to the
EMPLOYEE table. After you have entered all of the relevant data, click the Insert Operation button. This will insert
the SQL Operation into the application.
The next example shows how to use the WHERE clause in an SQL statement to restrict the rows returned by the query.
Only those rows meeting the criteria in the WHERE clause will be returned by the query.
The SQL statement used in this example is:
SELECT * FROM PJDATA.EMPLOYEE WHERE SALARY >= ?
This SQL query is different from the previous two because of the WHERE keyword that is added. The WHERE clause is
used to specify a search condition that will identify the row or rows you want to manipulate. Notice that the WHERE
clause contains a question mark. If we knew what value we wanted entered ahead of time, we could hard code the
value into the SQL Operation. A question mark allows the user to provide any value at run-time.
After you enter the value for SALARY, the query will display a table with all of the employees with salaries greater than
or equal to the value specified. The WHERE clause is usually used with comparison operators. You can include multiple
parameters in the WHERE clause to specify more complex queries.