Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
Explained
Start Thinking About Data in Sets, Not Rows.
B Y
J O E
W E E S S I E S
Listing 1
Employee Record
Employee_id - Key
Department_cd
Dept Update Record
Old_Dept_cd - Key
New_Dept_cd
Listing 2
Do Select
%select(employee_id,
department_cd)
select employee_id,
department_cd from
ps_employee
V P 1 O N L I N E . C O M
26
Listing 3
Listing 4
SQL
%select(new_dept_cd)
select new_dept_cd from
ps_dept_update where
old_dept_cd =
%bind(department_cd)
SQL
Update ps_employee set
department_cd =
%bind(new_dept_cd) where
employee_id =
%bind(employee_id)
Listing 5
27
SQL
update ps_employee
set department_cd = (select
A.new_dept_cd from
ps_update_dept A where
ps_employee.department_cd =
A.old_dept_cd)
V P 1
J A N
F E B
2 0 0 3