5. Table Table Column Name Data Type Data Length Nullable Default Value Constraint (PK. FK) Index
6. Index Index B-Tree Index Bitmap Index Hash Index Reverse Index ... Select * From Tab1 Where Name=‘Kong’ And Corporation=‘IBM’ And Country=‘CN’ ID Name Corporation Country … . … . … .. … . 1258 Kong IBM CN 1259 Kong IBM CN … . … … … 1335 ZhaoPing HP EN
7.
8. Store Procedure & Function Store Procedure CREATE { PROC | PROCEDURE } [schema_name.] procedure_name [ ;number ] [ { @parameter [ type_schema_name. ] data_type } [ VARYING ] [ = default ] [ OUT | OUTPUT ] [READONLY] ] [ ,...n ] [ WITH <procedure_option> [ ,...n ] ] [ FOR REPLICATION ] AS { [ BEGIN ] sql_statement [;] [ ...n ] [ END ] } [;] Function CREATE FUNCTION [ schema_name. ] function_name( [ { @parameter_name [ AS ][ type_schema_name. ] parameter_data_type [ = default ] [ READONLY ] } [ ,...n ] ] ) RETURNS return_data_type [ WITH <function_option> [ ,...n ] ] [ AS ] BEGIN function_body RETURN scalar_expression END [ ; ]
9. Trigger Trigger { CREATE | RECREATE | CREATE OR ALTER } TRIGGER name FOR { TABLE name | VIEW name} [ACTIVE | INACTIVE] {BEFORE | AFTER} { INSERT [ OR UPDATE ] [ OR DELETE ] | UPDATE [ OR INSERT ] [ OR DELETE ] | DELETE [ OR UPDATE ] [ OR INSERT ] } [POSITION n] AS BEGIN ..... END
10. Synonym Synonym Public Synonym CREATE PUBLIC SYNONYM employees for hr.employees; Private Synonym CREATE SYNONYM addresses FOR hr.locations;
11. Transaction Transaction 1. To provide reliable units of work that allow correct recovery from failures and keep a database consistent even in cases of system failure, when execution stops (completely or partially) and many operations upon a database remain uncompleted, with unclear status. 2. To provide isolation between programs accessing a database concurrently. Without isolation the program's outcomes are possibly erroneous.
12. How DML works Oracle Client 3.1 Syntax Validation 3.2 Objects Validation 3.3 Objects Locks 3.4 Access Right of Objects Validation 3.5 Explain Plan Sql Query Cache Sql Query Cache 2/5. SQL query + Plan 2. SQL query 1. SQL query Database 4. SQL query + Plan 6. SQL query + Plan 4.Exception
13. Database vs. Data Warehouse OLTP (Online Transaction Processing) OLAP (Online Analysis Processing)
04/07/11 Concepts What is Database A database is a collection of information that is organized so that it can easily be accessed, managed, and updated. In one view, databases can be classified according to types of content: bibliographic, full-text, numeric, and images. What is DBMS A DBMS is a set of software programs that controls the organization, storage, management, and retrieval of data in a database. DBMSs are categorized according to their data structures or types. The DBMS accepts requests for data from an application program and instructs the operating system to transfer the appropriate data. The queries and responses must be submitted and received according to a format that conforms to one or more applicable protocols. When a DBMS is used, information systems can be changed more easily as the organization's information requirements change. New categories of data can be added to the database without disruption to the existing system. What is DML Data Manipulation Language Select, Update, Insert, Delete What is DDL Data Definition Language Create, Drop, Alter, Truncate http://ww2.cis.temple.edu/cis109friedman/CIS%20109%20-%20Lecture%20Set%20I%20-%20Introduction%20and%20Overview/AAA%20Lecture%20Set%20I%20-%20Intro%20Material%20Ver%202.htm
04/07/11
04/07/11 Database Schema Table View Trigger Store Procedure Synonym DB Link Sequence
04/07/11 A database index is a data structure that improves the speed of data retrieval operations on a database table at the cost of slower writes and increased storage space. Indexes can be created using one or more columns of a database table , providing the basis for both rapid random lookups and efficient access of ordered records. B-Trees Index (Primary Key) Bitmap Index Hash Index Reverse Index Index based on Function
04/07/11 In database theory , a view consists of a stored query accessible as a virtual table composed of the result set of a query . Unlike ordinary tables (base tables) in a relational database , a view does not form part of the physical schema : it is a dynamic, virtual table computed or collated from data in the database . Changing the data in a table alters the data shown in subsequent invocations of the view.
04/07/11 A stored procedure is a subroutine available to applications accessing a relational database system . Stored procedures (sometimes called a proc , sproc , StoPro , StoredProc , or SP ) are actually stored in the database data dictionary .
04/07/11 A database trigger is procedural code that is automatically executed in response to certain events on a particular table or view in a database . The trigger is mostly used for keeping the integrity of the information on the database. For example, when a new record (representing a new worker) is added to the employees table, new records should be created also in the tables of the taxes, vacations, and salaries.
04/07/11 A Synonym is nothing more than an alias or alternate name for a table , view , Sequence , or other Schema object . They are used mainly to make it easy for users to access database objects owned by other users. They hide the underlying object's identity and make it harder for a malicious program or user to target the underlying object. Because a synonym is just an alternate name for an object, it requires no storage other than its definition. When an application uses a synonym, Oracle forwards the request to the synonyms underlying base object. By coding your programs to use synonyms instead of table names, you insulate yourself from any changes in the name, ownership, or table locations. If you frequently refer to a table that has a long name, you might appreciate being able to refer to it with a shorter name without having to rename the table and alter the code referring to that table.
04/07/11 A database transaction comprises a unit of work performed within a database management system (or similar system) against a database, and treated in a coherent and reliable way independent of other transactions. Transactions in a database environment have two main purposes: To provide reliable units of work that allow correct recovery from failures and keep a database consistent even in cases of system failure, when execution stops (completely or partially) and many operations upon a database remain uncompleted, with unclear status. To provide isolation between programs accessing a database concurrently. Without isolation the program's outcomes are possibly erroneous.
04/07/11
04/07/11 What is DW Data Warehouse Intelligence is a term to describe a system used in an organization to collect data, most of which are transactional data, such as purchase records and etc., from one or more data sources, such as the database of a transactional system, into a central data location, the Data Warehouse, and later report those data, generally in an aggregated way, to business users in the organization. This system generally consists of an ETL tool, a Database, a Reporting tool and other facilitating tools, such as a Data Modeling tool.