Professional Documents
Culture Documents
What is Data?
A representation of facts or instruction in a form suitable for communication - IBM Dictionary
What is a Database?
Is a repository for stored data - C.J.Date
Redundancy would occur because hierarchical databases handle one-tomany relationships well but do not handle many-to-many relationships well
Copyright 2004, Cognizant Academy, All Rights Reserved
Hierarchical Database
C Name
C Addr
Customers
Sold To
I#
C#
Dat e
Am t
Relational Database
Copyright 2004, Cognizant Academy, All Rights Reserved 4
Relation : A table or File Tuple : Row contains an entry for each attribute Attributes : Columns or the characteristics that define the entity Domain: A range of values (or Pool) Entity : Some object about which we wish to store information Null : Represents an unknown value Atomic : Smallest unit of data; the individual data value
Copyright 2004, Cognizant Academy, All Rights Reserved 6
DB2 Optimizer
D D F
Buffer Pools
IRLM
DB2 Catalog
10
INDEX
11
12
Simple Tablespace
Can contain more than one stored table Depending on application, storing more than one Table might enable faster retrieval for joins using these tables Usually only one table is preferred. This is because a single page can contain rows from all tables defined in the database. LOAD with replace option deletes all data
13
14
15
Rows
A View is a subset of columns that are open for a specific purpose. It can be a join of more than one tables. Indexes are based on the values of data in one or more columns. An index is an object that is separate from the data in the table. Indexes are used to enhance performance. These are discussed in detail further in the course.
Copyright 2004, Cognizant Academy, All Rights Reserved 16
Views
Views are a logical derivation of a table from other table/tables. A View does not exist in its own right. They provide a certain amount if logical independence They allow the same data to be seen by different users in different ways In DB2 a view that is to accept a update must be derived from a single base table
17
Synonym
Also means another name for the table, but is private to the user who created it.
18
SQL - Features
Unlike COBOL or 4GLs, SQL is coded without data-navigational instructions. The optimal access paths are determined by the DBMS. This is advantageous because the database knows better how it has stored data than the user. What you want and not how to get it Set level processing & multiple row processing
Copyright 2004, Cognizant Academy, All Rights Reserved 19
SPUFI
It supports the online execution of SQL statements from a TSO terminal Used for developers to check SQL statements or view table details Spufi menu contains the input file in which the SQL statements are coded, option for default settings and editing and the output file. Enter option 8.1 on the Cognizant m/f main menu. Provide the input/output datasets.
Copyright 2004, Cognizant Academy, All Rights Reserved 20
SQL
DDL
DML
DCL
GRANT REVOKE
21
Alter allows primary & Foreign key specifications to be changed It does not support changes to width or data type of a column or dropping a column
Drop Table Format: DROP : DROP TABLE <Tablename> Similar statements are there for other database objects
Copyright 2004, Cognizant Academy, All Rights Reserved 22
23
25
Queries
26