Добавил:
Upload Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
Semestr2 / 1 - Oracle / 1-Select+functions.ppt
Скачиваний:
15
Добавлен:
12.05.2015
Размер:
254.46 Кб
Скачать

Duplicateli Rows

The default display of queries is all rows, including duplicate rows.

SQL> SELECT deptno 2 FROM emp;

DEPTNO

---------

10

30

10

20

...

14 rows selected.

1-22

Eliminatingli i i Duplicateli Rows

Eliminate duplicate rows by using the DISTINCT keyword in the SELECT clause.

SQL> SELECT DISTINCT deptno 2 FROM emp;

DEPTNO

---------

10

20

30

1-23

SQL and SQL*Plusl InteractionI i

SQL Statements

SQL*Plus

Buffer

SQL Statements

Server

SQL*Plus

Query Results

Commands

 

Formatted Report

1-24

SQL Statements Versus

SQL*Plusl Commands

SQL

A language

ANSI standard

Keyword cannot be abbreviated

Statements manipulate data and table definitions in the database

SQL

statements

SQL

SQL*Plus

An environment

Oracle proprietary

Keywords can be abbreviated

Commands do not allow manipulation of values in the database

SQL*Plus

commands

1-25

Overviewie of SQL*Plusl

Log inin toto SQL*Plus* l ..

Describeri thet tablet le structuretr t re..

Editit yourr SQL statementt t t..

Executete SQL fromfr SQL*Plus* l ..

Save SQL statementst t ts toto filesfil and append SQL statementst t ts toto filesfil ..

Executete saved filesfil ..

Load commands fromfr filefile toto bufferff r toto editit..

1-26

Loggingi InIn to SQL*Plusl

From Windows environment:

From command line:

sqlplus [username[/password

[@database]]]

1-27

Displayingi l i Tablele Structure

Use the SQL*Plus DESCRIBE command to display the structure of a table.

DESC[RIBE] tablename

1-28

Displayingi l i Tablele Structure

SQL> DESCRIBE dept

 

 

 

 

 

 

Name

Null?

Type

 

 

-----------------

--------

------------

 

 

DEPTNO

NOT NULL NUMBER(2)

 

 

DNAME

 

VARCHAR2(14)

 

 

LOC

 

VARCHAR2(13)

 

 

 

 

 

 

1-29

SQL*Plusl Editingi i Commands

A[PPEND][ ] textt t

C[HANGE][ ] // oldld // new

C[HANGE][ ] // textt t //

CL[EAR][ ] BUFF[ER][ ]

DEL

DEL n

DEL m n

1-30

SQL*Plusl Editingi i Commands

I[NPUT]I[ ]

I[NPUT]I[ ] textt t

L[IST][I ]

L[IST][I ] n

L[IST][I ] m n

R[UN][ ]

n

n textt t

0 textt t

1-31

Соседние файлы в папке 1 - Oracle