Ver Mensaje Individual
  #7  
Antiguo 05-08-2013
Avatar de RONPABLO
[RONPABLO] RONPABLO is offline
Miembro Premium
 
Registrado: oct 2004
Posts: 1.514
Reputación: 21
RONPABLO Va por buen camino
Además en el SQL se podrá hacer cosas como estas:

Código SQL [-]
MERGE INTO customers c
  USING
    (SELECT * FROM customers_delta WHERE id > 10) cd
     ON (c.id = cd.id)
  WHEN MATCHED THEN
    UPDATE SET name = cd.name
  WHEN NOT MATCHED THEN
    INSERT (id, name)
    VALUES (cd.id, cd.name)


O para remplazar consultas como la siguiente:


Código SQL [-]

select
    id,
    department,
    salary,
    salary / (select sum(salary) from employee) percentage
  from employee
  order by id;

Se podrá usar algo que corre más rápido y se escribe en menos lineas como esto:
Código SQL [-]
select
    id,
    department,
    salary,
    salary / sum(salary) OVER () percentage
  from employee
  order by id;


En las dos obtendrá este mismo resultado:
Cita:

id department salary percentage
-- ---------- ------ ----------
1 R & D 10.00 0.2040
2 SALES 12.00 0.2448
3 SALES 8.00 0.1632
4 R & D 9.00 0.1836
5 R & D 10.00 0.2040
__________________
"Como pasa el tiempo..... ayer se escribe sin H y hoy con H"
Responder Con Cita