Before you can access a table, it must be defined to the database management system.
For example, to set up the EMPLOYEE table, you or the system administrator uses an appropriate tool to create the following DDL statement:
create table employee (emp_id integer not null, manager_id integer emp_fname varchar(2_) not null, emp_lname varchar(2_) not null, dept_id integer not null, street varchar(4_) not null, city char(2_) not null, state char(_4) not null, zip_code char(_9) not null, phone char(1_), status char(_1), ss_number integer not null, start_date date not null, termination_date date, birth_date date not null);
The system administrator specifies the column names and the kind of data you can put into each column.
Common Columns
The system administrator identifies potential relationships between tables and plans for common columns that can become foreign keys. You use these common columns when you want to join tables.
Temporary Tables
In a multi-user database environment, there are times when you need to store data for only a short period of time, perhaps as long as a program is running. When tables are set up for this purpose, they are called temporary tables.
The data in temporary tables is not stored in the database and is not accessible to other users.
For example, you may need to access all the company's accounts receivable data for the past five years. This information is stored in an accounts receivable history table that covers the past 15 years. You want to retrieve data in different forms, so you'll use several SELECT statements.
Rather than access the very large history table every time you need to retrieve data, you can define a temporary table that has data from just the past five years and retrieve from this smaller table. This allows you quicker and more efficient access to the data.
|
Copyright © 2014 CA.
All rights reserved.
|
|