Collection Contents Previous Next PDF

Introducing SQL Anywhere Studio

Using Interactive SQL

Lesson 3: Displaying data using Interactive SQL


One of the principal uses of Interactive SQL is to browse table data. This section shows how to query the information in the sample database. Queries take the form of SQL statements.

You can display database information using the SELECT statement in Interactive SQL. The following example shows the command to type in the SQL Statements pane. Once you have typed the command, you must click the Execute SQL Statement button on the toolbar to carry out the command.

After you execute the statement, the data (called a result set) appears on the Results tab in the Results pane. You can use the scroll bars to see areas of the table that are outside your current view of the pane. By default, row numbers appear to the left of the result set.

To list all the columns and rows of the employee table

  1. In the SQL Statements pane, type the following SQL query.

    SELECT * FROM employee
  2. Press F5 to execute the statement.

    The query displays all the columns of the table named employee. This table contains information about the employees of a fictitious merchandising company. The following appears:

    A result set displayed in Interactive SQL.

Interactive SQL retrieves the information by sending a request to your database server. The database server, in turn, looks up the information in the employee table and returns it to Interactive SQL.

At this point, you may want to look at the data in some of the other tables in the sample database, such as product, department, and sales_order.

emp_id manager_id emp_lname emp_fname ...
102 501 Fran Whitney ...
105 501 Matthew Cobb ...
129 902 Philip Chin ...
148 1293 Julie Jordan ...
...

You can add, delete, and update rows within the result set.

For more information about editing the result set, see Editing table values in Interactive SQL.


Editing table values in Interactive SQL
Copying rows from the Interactive SQL result set

Collection Contents Previous Next PDF