Documente Academic
Documente Profesional
Documente Cultură
TABLE OF CONTENTS
Introduction to Oracle...........................................................1
Oracle Utilities and Development Tools...............................................1
SQL*Plus..............................................................................1
Introduction.........................................................................................1
Getting Started....................................................................................1
Getting Help........................................................................................1
Entering and Executing SQL Statements.............................................1
Saving Buffer Contents........................................................................1
Retrieving and Executing SQL Files......................................................1
Describing Tables.................................................................................1
Quitting................................................................................................1
Structured Query Language (SQL)..........................................1
Types of SQL Statements.....................................................................1
Syntax.................................................................................................1
Oracle Express Download......................................................1
INTRODUCTION TO ORACLE
ORACLE UTILITIES AND DEVELOPMENT TOOLS
SQL*Plus:
Developer Suite:
Enterprise Manager:
1
SQL*PLUS
INTRODUCTION
SQL*Plus is essentially an interactive command editor which enables
the user to interrogate the database, e.g.:
2
GETTING STARTED
Open SQL*Plus, enter appropriate name, password, & host string
scott
psu
stddata
If the previous information have been entered correctly, SQL*Plus displays its own
command line prompt; by default, SQL>.
3
Any SQL command can be entered here
GETTING HELP
Full on-line help is available while using SQL*Plus.
To get help:
The buffer retains the contents of the latest SQL statement until a new
SQL statement is entered or the buffer is cleared using the clear
buffer command. The contents of the SQL buffer can be edited using
several commands. (see SQL part)
4
A / (on its own), or
The keyword run
If the .ext is omitted, the file will be given the extension .sql.
start filename[.ext]
or
@filename[.ext]
In either case the specified file is executed and the final SQL
statement in the file is retained in the buffer.
To load an SQL file into the buffer without executing it the following
command may be issued:
get filename[.ext]
5
a text editor (apart from its editing capabilities) is the ability to create
files containing multiple SQL statements.
6
DESCRIBING TABLES
The structure of any table within the database may be displayed by
entering the command describe at the SQL*Plus prompt.
Syntax:
describe tablename
The names and types of each column within the specified table will be
displayed.
QUITTING
To quit SQL*Plus, either one of the following commands can be used:
quit, or
exit.
7
STRUCTURED QUERY LANGUAGE (SQL)
TYPES OF SQL STATEMENTS
Data Definition Language (DDL):
8
SYNTAX
Data Types:
CHAR(n)
VARCHAR2(n)
NUMBER
NUMBER(n,d)
NUMBER(n)
DATE
NOT NULL
UNIQUE
PRIMARY KEY
CHECK (condition)
UNIQUE (column-list)
CHECK (condition)
9
CREATE TABLE Syntax:
[table-constraints])
FROM table-list
WHERE condition(s)
GROUP BY grouping-attributes
HAVING group-condition(s)
ORDER BY attribute-list
10
11
INSERT INTO Syntax:
VALUES (value-list)
SELECT statement
[WHERE conditions]
UPDATE Syntax:
UPDATE table
attribute-n = value-n
[WHERE conditions]
UPDATE table
SET (attribute-list)
(SELECT statement)
[WHERE conditions]
12
CREATE VIEW Syntax:
SELECT statement
To download, go to:
http://www.oracle.com/technetwork/database/express-
edition/overview/index.html
13
14
15
Then youll need to register to be able to download Oracle Database
XE.
16