Entry Level Technology Program

ORACLE
Introduction

Satyam Learning Center

ORACLE

Entry Level Technology Program

ORACLE Oak Ridge Automated Computer And Logical Engine

It is a DBMS, which manages a large amount of data in a multi user environment so that many users concurrently access the data. It Also provides security and Recovery. It stores and manages data using relational model. Oracle is the name of database management system developed by Oracle corporation.

Satyam Learning Center

ORACLE

ORACLE
Entry Level Technology Program

Oracle server manages data in the database. Users access Oracle server using SQL commands. So Oracle server receives SQL commands from users and execute them on the database. SQL commands
CLIENT Result Database CLIENT
Satyam Learning Center ORACLE

ORACLE SERVER

…………. ………….... ………….. LL T2 LOWER LEVEL STRUCTURE PL Satyam Learning Center ORACLE . …………... …………... T1 …………...DATABASE ARCHITECTURE Entry Level Technology Program U1 U2 VL SHADOW PAGE …………. …………. ………….. …………. ………….. ………….

It is physically a set of operating system files. Satyam Learning Center ORACLE . There are 3 types.  Data Files  Redo log files  Control files These files automatically creates when database is created.Physical Level Entry Level Technology Program The Physical structure of the database is placed in Physical level.

Redo Log Files Every database has a set of two or more Redo Log files. Only Oracle Server can interpret these data files. ( filenames redo01. The set of redo log files is known as database’s redo log.Physical structure Entry Level Technology Program Data Files It contains the data of the database.log) Satyam Learning Center ORACLE . All changes made to the database are written to redo log file. Redo Log files are used in failure recovery. Every table that is stored in the database is a part of these files..

It contains vital data regarding the database. It contains ( Extension of file is ctl) Database Name Names and locations of data files and redo log files. Path Oracle\oradata\orcl ( to see all the 3 types of files) Satyam Learning Center ORACLE .Physical Structure Entry Level Technology Program Control Files Every Oracle database has a control file.

Logical Structure
Entry Level Technology Program

Logical Structure is independent of Physical structure. Each Oracle database contains the following components. oTablespaces oSegments

oExtents
oBlocks

Satyam Learning Center

ORACLE

Tablespace
Entry Level Technology Program

Each Database is a collection of tablespaces.For example we can use a table space called PAYROLL to store all the data related to payroll application. Every database contains SYSTEM tablespace. This is automatically created when a database is created. SYSTEM tablespace contains the data dictionary tables. It is possible to make tablespace temporarily unavailable by making it off-line and make it available again by changing it to on-line.By making a tablespace off-line, DBA can take the backup.

Satyam Learning Center

ORACLE

SEGMENTS
Entry Level Technology Program

Data into tablespaces comes in the form of segments. Example Table is a segment An Oracle database requires upto 4 types of segments • Data segments • Index Segments It is used to store data of tables used to store indexes

• Rollback segments Here Undo information is stored

• Temporary segments Oracle stores Temporary tables

Satyam Learning Center

ORACLE

Each Tablespace contains 65536 data files N number of such Table spaces creates a database. An extent is made with in a data file N Number of continuous db blocks make up an Extent Table Table Segment Table space Satyam Learning Center ORACLE Extents .Extents Entry Level Technology Program The storage space is allocated to segments is in the form of Extents.

QUERY PROCESS Entry Level Technology Program 1 2 3 PARSING EXECUTE FETCH 3 2 SERVER PROCESS DB 1 CLIENT PROCESS CLIENT Satyam Learning Center ORACLE .

Every time a database is started. a memory area called System Global Area(SGA) or Shared Global Area is allocated and one or more processes are started.Oracle Instance Entry Level Technology Program . Every oracle database is associated with an Oracle Instance. Satyam Learning Center ORACLE . The combination of SGA and Oracle processes is called as Oracle Instance.

Features & Benefits Entry Level Technology Program ORACLE Scalability One Management Interface 9i INTERNET Reliability Single Dev Model Satyam Learning Center ORACLE Common Skill Sets .

It is called Oracle9i. PL/SQL.Features Entry Level Technology Program Oracle Offers a comprehensive high performance infrastructure for e-business. deploy and manage Internet Applications.It provides every thing needed to develop.JAVA and XML Satyam Learning Center ORACLE for all applications •One Management interface . easy development options •Common skill sets including SQL. available and secure architecture •One development model. Benefits • Scalability from departments to enterprise e-business sites •Reliable.

They provide a complete and simple infrastructure for internet applications. IAS DATABASE 9i Satyam Learning Center ORACLE 9i .9i Products Entry Level Technology Program There are two products.

Oracle 9i Application server runs Portals or web sites Java Transactional Applications Provides integration between users. applications and data Satyam Learning Center ORACLE .Application Server Entry Level Technology Program 9i Application server runs all the applications and 9i database stores our data.

Oracle9i : OORDBMS Entry Level Technology Program User-Defined data types and objects Fully compatible with relational database Support of multimedia and Large objects It also support client server and web based applications Oracle 9i can scale tens of thousands of concurrent users and support up to 512 petabytes of data ( A peta byte is 1000 tera bytes) Satyam Learning Center ORACLE .

does not have to be implemented on each machine Satyam Learning Center ORACLE . SQL*plus and iSQL*plus. iSQL*plus is oAn Environment oOracle proprietary oKeywords can be abbreviated oRuns on a browser oCentrally loaded.Environment Entry Level Technology Program Oracle uses two types of Environments for executing our SQL statements.

Tools of Oracle Entry Level Technology Program  SQL * PLUS  ISQLPLUS  PL/SQL  FORMS  REPORTS Satyam Learning Center ORACLE .

DELETE  Transaction Control Language (TCL) : COMMIT. REVOKE Satyam Learning Center ORACLE . SAVEPOINT  Data Retrieval Language (DRL) : SELECT  Data Control Language (DCL) : GRANT. UPDATE. DROP. TRUNCATE  Data Manipulation Language (DML) : INSERT.SQL commands Entry Level Technology Program  Data Definition Language (DDL) : CREATE. ROLLBACK. ALTER.

s) DATE LONG GB CLOB Data Type Variable-length character data(4000 Fixed-length character data up to 2000 Variable-length numeric data Date and time values Variable-length character data upto 2 Character data up to 4 GB Raw binary data (Raw is 2000 bytes and Long Raw is 4 GB) ORACLE Description RAW and LONG RAW Satyam Learning Center .Data Types Entry Level Technology Program VARCHAR2(size) bytes) CHAR (size) chars NUMBER (p.

Data Types Entry Level Technology Program  BLOB  BFILE Binary data up to 4 GB Binary data stored in an external file up to 4GB  NVARCHAR2(size) Variable-length character data(4000 bytes/chars) depending upon National Character Set  TIMESTAMP (precision) Date plus time Satyam Learning Center ORACLE .

Entry Level Technology Program Writing Basic SQL SELECT Statements Satyam Learning Center ORACLE .

} table.  SELECT identifies what columns  FROM identifies which table Satyam Learning Center ORACLE .Basic SELECT Statement Entry Level Technology Program SELECT FROM *|{[DISTINCT] column|expression [alias]....

DESC[RIBE] DEPT SELECT DEPTNO.Selecting All Tables and Columns Entry Level Technology Program SELECT * FROM TAB. SELECT * FROM DEPT.LOC FROM DEPT. Satyam Learning Center ORACLE .

 Clauses are usually placed on separate lines.  SQL statements can be on one or more lines.  Keywords cannot be abbreviated or split across lines.  Indents are used to enhance readability. Satyam Learning Center ORACLE .Writing SQL Statements Entry Level Technology Program  SQL statements are not case sensitive.

SAL. Satyam Learning Center ORACLE .Using Arithmetic Operators Entry Level Technology Program SELECT ENAME. SAL + 300 FROM EMP.

unknown. unassigned. or inapplicable.  A null is not the same as zero or a blank space. SAL. JOB. COMM FROM EMP. SELECT ENAME.Defining a Null Value Entry Level Technology Program  null is a value that is unavailable. Satyam Learning Center ORACLE .

SELECT ENAME. 12*SAL*COMM FROM EMP.Null Values in Arithmetic Expressions Entry Level Technology Program Arithmetic expressions containing a null value evaluate to null. Satyam Learning Center ORACLE .

Defining a Column Alias Entry Level Technology Program A column alias:  Renames a column heading  Is useful with calculations  Immediately follows the column name .there can also be the optional AS keyword between the column name and alias  Requires double quotation marks if it contains spaces or special characters or is case sensitive Satyam Learning Center ORACLE .

SAL*12 "Annual Salary" FROM EMP.Using Column Aliases Entry Level Technology Program SELECT ENAME AS name . SELECT EENAME "Name". COMM commission FROM EMP. Satyam Learning Center ORACLE .

Concatenation Operator Entry Level Technology Program A concatenation operator:  Concatenates columns or character strings to other columns  Is represented by two vertical bars (||)  Creates a resultant column that is a character expression Satyam Learning Center ORACLE .

Entry Level Technology Program Using the Concatenation Operator SELECT FROM ENAME || JOB AS "Employees" EMP. Satyam Learning Center ORACLE .

or a date included in the SELECT list.Literal Character Strings Entry Level Technology Program  A literal is a character. Satyam Learning Center ORACLE . a number.  Date and character literal values must be enclosed within single quotation marks.  Each character string is output once for each row returned.

Entry Level Technology Program Using Literal Character Strings SELECT ENAME ||' is a ' ||JOB AS "Employee Details" FROM EMP. Satyam Learning Center ORACLE .

Satyam Learning Center ORACLE . including duplicate rows. SELECT DEPTNO FROM EMP.Duplicate Rows Entry Level Technology Program The default display of queries is all rows.

Satyam Learning Center ORACLE . SELECT DISTINCT DEPTNO FROM EMP.Eliminating Duplicate Rows Entry Level Technology Program Eliminate duplicate rows by using the DISTINCT keyword in the SELECT clause.

Entry Level Technology Program Restricting and Sorting Data Satyam Learning Center ORACLE .

Objectives Entry Level Technology Program After completing this lesson. you should be able to do the following:  Limit the rows retrieved by a query  Sort the rows retrieved by a query Satyam Learning Center ORACLE .

... SELECT FROM [WHERE *|{[DISTINCT] column|expression [alias].  The WHERE clause follows the FROM clause.Limiting the Rows Selected Entry Level Technology Program  Restrict the rows returned by using the WHERE clause.} table condition(s)]. Satyam Learning Center ORACLE .

JOB.Using the WHERE Clause Entry Level Technology Program SELECT EMPNO. ENAME. DEPTNO FROM EMP WHERE DEPTNO = 30 . Satyam Learning Center ORACLE .

and date values are format sensitive. JOB.  Character values are case sensitive. SELECT ENAME.Character Strings and Dates Entry Level Technology Program  Character strings and date values are enclosed in single quotation marks. Satyam Learning Center ORACLE .  The default date format is DD-MON-RR. DEPTNO FROM WHERE EMP ENAME = 'WARD'.

Comparison Conditions Entry Level Technology Program Operator = > >= < <= <> Meaning Equal to Greater than Greater than or equal to Less than Less than or equal to Not equal to Satyam Learning Center ORACLE .

Satyam Learning Center ORACLE .Using Comparison Conditions Entry Level Technology Program SELECT ENAME. SAL FROM WHERE EMP SAL <= 3000.

. IN(set) LIKE IS NULL Match any of a list of values Match a character pattern Is a null value Satyam Learning Center ORACLE ...AND.Entry Level Technology Program Other Comparison Conditions Operator BETWEEN . Meaning Between two values (inclusive)..

Lower limit Upper limit Satyam Learning Center ORACLE .Using the BETWEEN Condition Entry Level Technology Program Use the BETWEEN condition to display rows based on a range of values. SELECT ENAME. SAL FROM WHERE EMP SAL BETWEEN 2500 AND 3500.

Satyam Learning Center ORACLE . FROM WHERE EMP MGR MGR IN (7900.7982 ). SELECT EMPNO. ENAME.Using the IN Condition Entry Level Technology Program Use the IN membership condition to test for values in a list. SAL. 7566.

Using the LIKE Condition Entry Level Technology Program  Use the LIKE condition to perform wildcard searches of valid search string values.  _ denotes one character. Satyam Learning Center ORACLE . SELECT FROM WHERE ENAME EMP ENAME LIKE 'S%'.  Search conditions can contain either literal characters or numbers:  % denotes zero or many characters.

Satyam Learning Center ORACLE .Using the LIKE Condition Entry Level Technology Program  You can combine pattern-matching characters. SELECT ENAME FROM WHERE EMP ENAME LIKE '_o%'.  You can use the ESCAPE identifier to search for the actual % and _ symbols.

Satyam Learning Center ORACLE . SELECT ENAME. MGR FROM WHERE EMP MGR IS NULL.Using the NULL Conditions Entry Level Technology Program Test for nulls with the IS NULL operator.

Logical Conditions Entry Level Technology Program Operator AND OR Meaning Returns TRUE if both component conditions are true Returns TRUE if either component condition is true Returns TRUE if the following condition is false NOT Satyam Learning Center ORACLE .

Satyam Learning Center ORACLE . SAL FROM WHERE AND EMP SAL >=10000 JOB LIKE '%MAN%'.Using the AND Operator Entry Level Technology Program AND requires both conditions to be true. JOB. SELECT EMPNO. ENAME.

Using the OR Operator Entry Level Technology Program OR requires either condition to be true. JOB. ENAME. SAL FROM EMP WHERE OR SAL >= 10000 JOB LIKE '%MAN%'. SELECT EMPNO. Satyam Learning Center ORACLE .

JOB FROM EMP WHERE JOB NOT IN (‘MANAGER'.Using the NOT Operator Entry Level Technology Program SELECT ENAME. Satyam Learning Center ORACLE . 'CLERK'. 'SALESMAN').

LIKE.Rules of Precedence Entry Level Technology Program Order Evaluated 1 2 3 4 5 6 7 8 Operator Arithmetic operators Concatenation operator Comparison conditions IS [NOT] NULL. Satyam Learning Center ORACLE . [NOT] IN [NOT] BETWEEN NOT logical condition AND logical condition OR logical condition Override rules of precedence by using parentheses.

Rules of Precedence Entry Level Technology Program SELECT ENAME. SAL FROM WHERE OR EMP JOB = 'SALESMAN' JOB = 'PRESIDENT' AND SAL > 15000. JOB. Satyam Learning Center ORACLE .

Rules of Precedence Entry Level Technology Program Use parentheses to force priority. Satyam Learning Center ORACLE . JOB. SELECT ENAME. SAL FROM WHERE OR AND EMP (JOB = 'SALESMAN' JOB = 'PRESIDENT') SAL > 15000.

Satyam Learning Center ORACLE . default  DESC: descending order  The ORDER BY clause comes last in the SELECT statement. DEPTNO.ORDER BY Clause Entry Level Technology Program  Sort rows with the ORDER BY clause  ASC: ascending order. JOB. SELECT FROM ENAME. HIREDATE EMP ORDER BY HIREDATE .

HIREDATE FROM EMP ORDER BY HIREDATE DESC .Sorting in Descending Order Entry Level Technology Program SELECT ENAME. Satyam Learning Center ORACLE . JOB. DEPTNO.

Sorting by Column Alias Entry Level Technology Program SELECT EMPNO. Satyam Learning Center ORACLE . ENAME. SAL*12 annsal FROM EMP ORDER BY annsal.

Sorting by Multiple Columns Entry Level Technology Program  The order of ORDER BY list is the order of sort.  You can sort by a column that is not in the SELECT list. DEPTNO. SAL FROM EMP ORDER BY DEPTNO. SAL DESC. SELECT EMPNO. Satyam Learning Center ORACLE .

. Satyam Learning Center ORACLE . and NULL conditions – Apply the logical AND. you should have learned how to: • Use the WHERE clause to restrict rows of output – Use the comparison conditions – Use the BETWEEN.Summary Entry Level Technology Program In this lesson. and NOT operators • Use the ORDER BY clause to sort rows of output SELECT FROM [WHERE [ORDER BY *|{[DISTINCT] column|expression [alias]. OR. IN. expr...} table condition(s)] {column. LIKE. alias} [ASC|DESC]].

Exercise Entry Level Technology Program            1) 2) 3) 4) 5) 6) Display the names with single word Display the names with two words Display the names with exactly three words Display all the salaries beginning with digit 2 Display all the names with second letter as ‘A’ Display the employees who joined between any two given dates 7) Display the names and experience of all the employees 8) How many employees does not draw salary between 5000 and 10000 9) Display all the names whose names contain underscore(_) 10)Calculate the experience in years for each employee and display along with their names. Satyam Learning Center ORACLE . in descending order.

Sign up to vote on this title
UsefulNot useful