About Views

A view is a computed table that may be useful for security purposes, and for tailoring the appearance of database information to make data access straightforward. SAP Sybase IQ provides views that allow you to give names to frequently executed SELECT commands, saving you from having to repeatedly type them.

Think of views as computed tables. You can use any SELECT command in a view definition except commands containing ORDER BY. Views can use GROUP BY clauses, subqueries, and joins. Disallowing ORDER BY in the commands that make up a view is consistent with the fact that rows of a table in a relational database are not stored in any particular order. When you use the view, you can specify an ORDER BY.

For example, if you frequently need to list a summary of employees and their departments, create a view called emp_dept that looks just like any other table in the iqdemo database. You can list everything in a view just as you do from a table.

The information in a view is not stored separately in the database. Each time you refer to a view, SQL executes the associated SELECT statement to find the appropriate data.

This also means that if someone modifies the employee table or the department table, the information in the emp_dept view is automatically up to date. However, if the SELECT command is complicated, it may take a long time for SQL to find the correct information every time you use the view.

You can also use views in more complicated queries, such as queries using joins:

SELECT LastName, dept_head_id
FROM emp_dept, department
WHERE emp_dept.Department = department.dept_name
Related concepts
View Permissions
View Triggers
Materialized Views
Related tasks
Creating a View
Viewing View Data in the Execute SQL Window
Recompiling and Enabling a View
Disabling a View
Deleting a View
Generating View DDL Commands
Viewing or Modifying View Properties
Related reference
View Privilege Summary