In this section, you will look at the data in the Employees table.
The sample database you use in this tutorial is the same fictional company as in Introduction to Sybase IQ. The database contains information about employees, departments, sales orders, and so on. All the information is organized into tables.
In Introduction to Sybase IQ, you learned how to display a list of tables by opening the Tables folder in Sybase Central. You can also list user tables from interactive SQL using a system stored procedure, sp_iqtable. System stored procedures are system functions that are implemented as stored procedures in Sybase IQ.
In the SQL Statements window, type sp_iqtable
to
run the system stored procedure of the same name.
For complete details about this and other system stored procedures, see Chapter 7, “System Procedures” in Reference: Building Blocks, Tables, and Procedures.
In this lesson, you view one of the tables in the database. The command used will look at everything in a table called Employees.
Execute the command:
SELECT * FROM Employees
The asterisk is a short form for all the columns in the table.
The SELECT statement retrieves all the rows and columns of the Employees table, and the Interactive SQL Results window lists those that will fit:
EmployeeID |
ManagerID |
Surname |
GivenName |
DepartmentID |
... |
---|---|---|---|---|---|
102 |
501 |
Whitney |
Fran |
100 |
... |
105 |
501 |
Cobb |
Matthew |
100 |
... |
129 |
902 |
Chin |
Philip |
200 |
... |
148 |
1293 |
Jordan |
Julie |
300 |
... |
160 |
501 |
Breault |
Robert |
100 |
... |
184 |
1576 |
Espinoza |
Melissa |
400 |
... |
191 |
703 |
Bertrand |
Jeannette |
500 |
... |
195 |
902 |
Dill |
Marc |
200 |
... |
207 |
1576 |
Francis |
Jane |
400 |
... |
The Employees table contains a number of rows organized into columns. Each column has a name, such as Surname or EmployeeID. There is a row for each employee of the company, and each row has a value in each column. For example, the employee with EmployeeID 102 is Fran Whitney, whose manager is ManagerID 501.
You will also see some information in the Interactive SQL Messages window. This information is explained later.
Tablest in this document that display query results may only include some of the data returned by the query. Columns and rows with elliptical values indicate additional query results.
The Employees table name is shown starting with an uppercase E, even though the real table name is all lowercase. Sybase IQ databases can be created as case sensitive (the default) or case insensitive in their string comparisons, but are always case insensitive in their use of identifiers.
The examples in this book were created case insensitive, using the CREATE DATABASE qualifier CASE IGNORE. The default is CASE RESPECT, which gives better performance.
For information on creating databases, see Chapter 5, “Working with Database Objects,” in the System Administration Guide: Volume 1.
You can type select or Select instead of SELECT. Sybase IQ 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.
Manipulation of the Interactive SQL environment and use of Interactive SQL is specific to the operating system.
For information on how to scroll through data and manipulate the Interactive SQL environment, see Chapter 2, “Using Interactive SQL (dbisql)” in Utility Guide.