Chapter Contents |
Previous |
Next |
SAS/ACCESS Software for Relational Databases: Reference |
A relational DBMS organizes and accesses data according to relationships among data items. The relationships among data items are expressed by tables consisting of columns and rows. The order of the rows and columns is not significant. Each column can contain one type of data, and each row can hold one data value for each column. See A DBMS Table for a conceptual picture of a table.
In a relational DBMS, you use a high-level language to operate on the data managed by the DBMS. In many cases, that language is SQL. A DBMS enables you, or an application program such as the SAS System, to use SQL statements to read, modify, create, and protect the data it manages.
Databases |
Tables |
In many databases, tables are created with the SQL statement CREATE TABLE. This statement names the table and the columns and defines the data type of each column.
A DBMS Table illustrates four columns from the CUSTOMERS table and highlights a column and a row.
If you want to use a table that you do not own, the table's owner must grant you privileges to the table.
Views |
When you reference a view in an SQL statement, the DBMS accesses the table(s) or view(s) on which the view is based. Certain restrictions might apply when a view derives its data from multiple tables or other views. For example, updates, inserts, and deletes might not be allowed. For more information on view restrictions, refer to your DBMS documentation.
Note: To access a view owned by another user, you must be
granted privileges on the view and on its underlying tables and views. Having
privileges on the table(s) from which a view derives its data does not automatically
give you privileges on the view.
Note: If a table from which a view derives its data is dropped, the view itself
is also dropped.
Indexes |
An index is keyed on all specified columns unless the KEY option is used. Keys provide a way to identify rows and relate (or join) rows in one table to rows in another table. A primary key is the column or combination of columns that uniquely identify a row. A foreign key is a column or combination of columns in one table that reference the primary key in another table. The foreign key must have the same attributes as the primary key it references.
If the table on which an index is created is dropped, the index is also dropped.
Most DBMSs automatically determine the most efficient way to process an SQL statement and uses the appropriate indexes if they are available. In addition, the way you specify criteria for selecting rows can affect whether the DBMS can use the indexes. Your database administrator can help you determine whether your selection criteria enable the DBMS to use your tables' indexes.
Stored Procedures |
Stored procedures can generally take parameters, return status values and parameters, and call other procedures. They can also be executed on remote servers. Stored procedures are often created to execute groups of SQL statements that are submitted repeatedly. For example, a stored procedure might be created to list all the orders that were backordered for a particular stock number and to remove the back-order status from that stock number. The stored procedure could then be used whenever a formerly out-of-stock product is back in stock.
See your DBMS documentation for information on whether your DBMS supports stored procedures and how to create them.
Triggers |
A trigger is automatically executed, or "fired," by the DBMS when a specified SQL statement is issued against a table. You can define triggers for SQL DELETE, INSERT, and UPDATE statements. You also define whether a trigger fires before or after a specified SQL statement is executed or once for each row affected by the statement.
The SAS/ACCESS interface view engine generally supports all actions and constraints specified by triggers. For more information, refer to your DBMS documentation.
Constraints |
A constraint restricts the values that can be stored in a table.
A constraint checks the values you insert or update in a table against the
conditions specified by the constraint. For example, a constraint could ensure
that the value entered for the column GENDER is only
M
or
F
. Constraints help ensure the referential integrity in a database.
See your DBMS documentation for additional information on how your DBMS supports
referential integrity.
Chapter Contents |
Previous |
Next |
Top of Page |
Copyright 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.