Académique Documents
Professionnel Documents
Culture Documents
Descripcin
Tabla
Vista
Secuencia
Indice
Sinnimo
Program unit
Introduction-2
Copyright Oracle Corporation, 1996. All rights reserved.
Page 1
1
Integridad
Referencial
Que es Oracle?
Configuracin
Cliente -Servidor
Introduction-4
Copyright Oracle Corporation, 1996. All rights reserved.
Page 2
2
Server
User Tables
Data
Dictionary
Introduction-5
Copyright Oracle Corporation, 1996. All rights reserved.
SQL
SQL*Plus
Una herramienta de
PL/SQL
Un lenguaje de procedimiento de
Oracle que
extiende las instrucciones del SQL con
tratamientos repetitivos y alternativos.
Introduction-6
Copyright Oracle Corporation, 1996. All rights reserved.
Page 3
3
Server
SQL*Plus
Buffer
SQL and
PL/SQL
Scripts
Introduction-7
Copyright Oracle Corporation, 1996. All rights reserved.
Recuperacin de datos
SELECT
Page 4
4
Ambiente
Formato
Manipulacin de archivos
Ejecucin
Edicin
Interaccin
Miscelaneas
Introduction-9
Copyright Oracle Corporation, 1996. All rights reserved.
EL CURSO ES TEORICO-PRACTICO
En el siguiente digarama ER se presenten las entidades del caso
Tienda de artculos deportivos para alpinismo
Introduction-10
Copyright Oracle Corporation, 1996. All rights reserved.
Page 5
5
S_CUSTOMER
S_ORD
S_INVENTORY
S_EMP
S_PRODUCT
S_WAREHOUSE
S_DEPT
S_REGION
Introduction-11
Copyright Oracle Corporation, 1996. All rights reserved.
Leccin 1
Seleccionando Filas
Introduction-12
Copyright Oracle Corporation, 1996. All rights reserved.
Page 6
6
Introduction-13
Copyright Oracle Corporation, 1996. All rights reserved.
Introduction-14
Copyright Oracle Corporation, 1996. All rights reserved.
Page 7
7
SELECT clusula
Asterisco (*)
FROM clusula
SQL> SELECT
2 FROM
*
s_dept;
Introduction-15
Copyright Oracle Corporation, 1996. All rights reserved.
*
s_dept;
NAME
REGION_ID
------------- ---------Finance
1
Sales
1
Sales
2
Sales
3
Sales
4
Sales
5
Operations
1
Operations
2
Operations
3
Operations
4
Operations
5
Administration
1
12 rows selected.
Introduction-16
Copyright Oracle Corporation, 1996. All rights reserved.
Page 8
8
Introduction-17
Copyright Oracle Corporation, 1996. All rights reserved.
Expresiones Aritmticas
Para crear expresiones con columnas tipo
NUMBER o DATE use operadores.
Suma
Resta
Multiplicacin *
Divisin
Introduction-18
Copyright Oracle Corporation, 1996. All rights reserved.
Page 9
9
Expresiones Aritmticas
Presente el salario anual de todos los empleados.
SQL> SELECT
2 FROM
LAST_NAME
SALARY*12 COMMISSION_PCT
------------ ------------ -------------...
Havel
15684
Magee
16800
10
Giljum
17880
12.5
Sedeghi
18180
10
Nguyen
18300
15
Dumas
17400
17.5
Maduro
16800
...
Introduction-19
Copyright Oracle Corporation, 1996. All rights reserved.
Introduction-20
Copyright Oracle Corporation, 1996. All rights reserved.
Page 10
10
Precedencia de Operadores
Los parntesis cambian el orden en que la sentencia
es ejecutada.
SQL> SELECT
2 FROM
SQL> SELECT
2 FROM
Introduction-21
Copyright Oracle Corporation, 1996. All rights reserved.
Alias de Columna
Un alias de columna renombra su encabezado.
Introduction-22
Copyright Oracle Corporation, 1996. All rights reserved.
Page 11
11
Operador de Concatenacin
El operador de concatenacin es representado por
dos barras verticales (||).
Introduction-23
Copyright Oracle Corporation, 1996. All rights reserved.
Page 12
12
Introduction-25
Copyright Oracle Corporation, 1996. All rights reserved.
Employees
-------------------------------------------Carmen Velasquez, President
LaDoris Ngao, VP, Operations
Midori Nagayama, VP, Sales
Mark Quick-To-See, VP, Finance
Audry Ropeburn, VP, Administration
Molly Urguhart, Warehouse Manager
...
Introduction-26
Copyright Oracle Corporation, 1996. All rights reserved.
Page 13
13
last_name, title,
salary*commission_pct/100 COMM
s_emp;
Introduction-27
Copyright Oracle Corporation, 1996. All rights reserved.
Funcin NVL
Convierte el NULO al valor que seale con el NVL.
last_name, title,
salary*NVL(commission_pct,0)/100 COMM
s_emp;
Introduction-28
Copyright Oracle Corporation, 1996. All rights reserved.
Page 14
14
Filas Duplicadas
name
s_dept;
DISTINCT name
s_dept;
Introduction-29
Copyright Oracle Corporation, 1996. All rights reserved.
Introduction-30
Copyright Oracle Corporation, 1996. All rights reserved.
Page 15
15
Entrar al SQL*Plus.
Formatee columnas.
Introduction-31
Copyright Oracle Corporation, 1996. All rights reserved.
Entrar al SQL*Plus
Double-click al cono.
sqlplus [username[/password]]
Introduction-32
Copyright Oracle Corporation, 1996. All rights reserved.
Page 16
16
DESCRIBE s_dept
A[PPEND] texto
C[HANGE] / antiguo/ nuevo
CL[EAR] BUFF[ER]
DEL
I[NPUT] texto
L[IST] n
n texto
Introduction-34
Copyright Oracle Corporation, 1996. All rights reserved.
Page 17
17
Introduction-35
Copyright Oracle Corporation, 1996. All rights reserved.
SAVE filename
GET filename
START filename
@ filename
EDIT filename
SPOOL filename
EXIT
Introduction-36
Copyright Oracle Corporation, 1996. All rights reserved.
Page 18
18
Online Help
SQL>
Comandos SQL*Plus
Comandos SQL
Comandos PL/SQL
HELP SELECT
Introduction-37
Copyright Oracle Corporation, 1996. All rights reserved.
Introduction-38
Copyright Oracle Corporation, 1996. All rights reserved.
Page 19
19
Columnas Number
9
Introduction-40
Copyright Oracle Corporation, 1996. All rights reserved.
Page 20
20
Resumen
SELECT
[DISTINCT] {*,column[alias],...}
FROM
table;
Introduction-41
Copyright Oracle Corporation, 1996. All rights reserved.
Leccin 2
Introduction-42
Copyright Oracle Corporation, 1996. All rights reserved.
Page 21
21
Objetivos
Introduction-43
Copyright Oracle Corporation, 1996. All rights reserved.
La clsula ORDER BY
Clasifique filas con la clusula ORDER BY.
SQL> SELECT
2 FROM
3 ORDER BY
Introduction-44
Copyright Oracle Corporation, 1996. All rights reserved.
Page 22
22
La clusula ORDER BY
last_name, start_date
s_emp
EMPLOYEE DESC;
last_name, salary * 12
s_emp
2;
Introduction-46
Page 23
23
Introduction-47
Copyright Oracle Corporation, 1996. All rights reserved.
SQL> SELECT
2 FROM
3 WHERE
Introduction-48
Copyright Oracle Corporation, 1996. All rights reserved.
Page 24
24
AND
OR
NOT
Introduction-49
Copyright Oracle Corporation, 1996. All rights reserved.
Expresiones Negativas
Para excluir filas que Ud. no desea presentar
fcilmente puede eliminarlas.
Operadores SQL
NOT BETWEEN
NOT IN
NOT LIKE
IS NOT NULL
Introduction-50
Copyright Oracle Corporation, 1996. All rights reserved.
Page 25
25
SQL> SELECT
2 FROM
3 WHERE
4
Introduction-51
Copyright Oracle Corporation, 1996. All rights reserved.
last_name
s_emp
last_name LIKE 'M%';
Introduction-52
Copyright Oracle Corporation, 1996. All rights reserved.
Page 26
26
last_name, start_date
s_emp
start_date LIKE '%91';
last_name
s_emp
last_name LIKE '_a%';
Introduction-53
Copyright Oracle Corporation, 1996. All rights reserved.
SQL> SELECT
id, name, credit_rating
2 FROM s_customer
3 WHERE sales_rep_id IS NULL;
Introduction-54
Copyright Oracle Corporation, 1996. All rights reserved.
Page 27
27
Condiciones Mltiples
SQL>
2
3
4
SELECT
FROM
WHERE
AND
SELECT
FROM
WHERE
OR
Introduction-55
Copyright Oracle Corporation, 1996. All rights reserved.
Operator
AND
OR
Introduction-56
Copyright Oracle Corporation, 1996. All rights reserved.
Page 28
28
SELECT
FROM
WHERE
AND
OR
SELECT
FROM
WHERE
AND
OR
Introduction-57
Copyright Oracle Corporation, 1996. All rights reserved.
Resumen
SELECT
FROM
[WHERE
[ORDER BY
Introduction-58
Copyright Oracle Corporation, 1996. All rights reserved.
Page 29
29