User Tools

Site Tools


kurs:einfache_selects

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
kurs:einfache_selects [2013/04/29 12:46]
mh
kurs:einfache_selects [2014/09/10 21:22] (current)
Line 46: Line 46:
        -- commission_pct in (0.15, 0.2, 0.3, null)        -- commission_pct in (0.15, 0.2, 0.3, null)
 </​code>​ </​code>​
 +
 +<​code>​
 +with emp_com as (
 + ​select first_name, ​
 +       ​last_name,​
 +       ​hire_date,​
 +       ​salary, ​                 ​
 +       ​coalesce(commission_pct,​ 0) comm_pct
 +     from employees
 +)
 +select first_name, ​
 +       ​last_name,​
 +       ​hire_date,​
 +       ​salary, ​                 ​
 +       ​comm_pct,​
 +       ​salary * comm_pct "der bonus"
 +  from emp_com
 +</​code>​
 +
 +<​code>​
 +/* create view v_emp_com as 
 + ​select first_name, ​
 +       ​last_name,​
 +       ​hire_date,​
 +       ​salary+5 salary, ​                 ​
 +       ​coalesce(commission_pct,​ 0) comm_pct
 +     from employees
 +*/
 +
 +select first_name, ​
 +       ​last_name,​
 +       ​hire_date,​
 +       ​salary, ​                 ​
 +       ​comm_pct,​
 +       ​salary * comm_pct "der bonus"
 +  from v_emp_com
 +</​code>  ​
 +
kurs/einfache_selects.txt ยท Last modified: 2014/09/10 21:22 (external edit)