Professional Documents
Culture Documents
ITP SQL NCS Day2 02
ITP SQL NCS Day2 02
Oracle Architecture
Aggregate Functions
Regular Expressions
---------------------------------------------
10 ACCOUNTING
20 RESEARCH
30 SALES
40 OPERATIONS
7369 SMITH 20
7566 JONES 20
7788 SCOTT 20
7876 ADAMS 20
7902 FORD 20
CLERK
MANAGER
PRESIDENT
SALESMAN
CONFIDENTIAL© Copyright 2008 Tech Mahindra Limited 8
ORDER BY clause
Sorts records using specified criteria in ascending or
descending order
Syntax:
ORDER BY <col>|<expression> [ASC | DESC] [, expression
[ASC | DESC] ...]
Examples:
Oracle Server
I N S T A N C E
Server
Shared Pool System Global Area
Library Cache
User
User Process
The buffer is reused after it is filled, once all the old redo
entries are recorded in the redo log files
The DBW0 writes the dirty buffers from the database buffer
cache to the data files
A checkpoint occurs
Includes:
Rolling back user transactions
Data Blocks:
At the finest level of granularity, the data is stored in data
blocks
One data block corresponds to one or more OS blocks allocated
from the existing data file
Data block size should be a multiple of the OS block size to
avoid unnecessary I/O
Table
Segment
Data Block 8KB 8KB 8KB 8KB 8KB 8KB 8KB 8KB 8KB
Data Files:
At least one data file for each tablespace
Can belong to only one tablespace
Contain the data in database, including tables, indexes, rollback segments &
temp segments
Listener.ora File:
Resides on the host node
Client requests use the listener processes for connection to the
database
Relational
= , < , > , <= , >=
< >, != , ^=
Boolean
AND, OR, NOT
Set Operators
UNION, UNION ALL, INTERSECT, MINUS
Others
IN, BETWEEN
LIKE , IS NULL
ENAME
----------
JAMES
---------------------------------------------------
Can be nested
Character
Date
Conversion
Aggregate Functions
Regular Expressions
TRIM
LTRIM, RTRIM
Uses:
Data Validation
Identifies duplicate word occurrences
Locates patterns like HTML tags, numbers, dates etc.
REGEXP_INSTR:
REGEXP_INSTR(source, regexp, position, occurrence,
return_option, modes)
VE
---
10
An Example,
SELECT regexp_replace('Oracle10g','([[:alpha:]]+)
([[:digit:]]
+.)', '\1\2') FROM dual;
REGEXP_REP
----------------
Oracle 10g