Contents IndexChapter 7.  Selecting Data from Database Tables Ordering query results

User's Guide
   Part II. Tutorials
     Chapter 7. Selecting Data from Database Tables
      Looking at the information in a table

The database you use in this tutorial is for a fictional company. The database contains information about employees, departments, sales orders, and so on. All the information is organized into a number of tables.

Using the SELECT statement

In this lesson, you look at one of the tables in the database. The command used will look at everything in a table called employee. Execute the command:

     SELECT * FROM Employee

Case sensitivity

The table name employee is shown starting with an upper case E, even though the real table name is all lower case. SQL Anywhere databases can be created as case-sensitive or case-sensitive in their string comparisons, but are always case insensitive in their use of identifiers. For information on creating databases, see the chapter "Initializing a database", or the description of the DBINIT command in the chapter "SQL Anywhere Components".

You can type select or Selectinstead of SELECT. SQL Anywhere allows you to type keywords in uppercase, lowercase, or any combination of the two. In this manual, uppercase letters are generally used for SQL keywords.

The SELECT statement retrieves all the rows and columns of the employee table, and the ISQL Data window lists those that will fit:

emp_id manager_id emp_fname emp_lname dept_id
102 501 Fran Whitney 100
105 501 Matthew Cobb 100
129 902 Philip Chin 200
148 1293 Julie Jordan 300
160 501 Robert Breault 100

You will also see some information in the ISQL statistics window. This information is explained later.

The employee table contains a number of rows organized into columns. Each column has a name, such as emp_lname or emp_id. There is a row for each employee of the company, and each row has a value in each column. For example, the employee with employee ID 102 is Fran Whitney, whose manager is employee ID 501.

Manipulation of the ISQL environment is specific to the operating system you are running in.

For information on how to scroll the data and manipulate the ISQL environment, see the chapter "Using ISQL" or "Using Character-Mode ISQL".

Contents IndexChapter 7.  Selecting Data from Database Tables Ordering query results