You are on page 1of 3

SQL>desc employees

SQL>select * from employees;


SQL>select distinct department_id from employees;
**OPERATOR PRECEDENCE**
SQL> select salary, salary + 300 from employees;
SALARY SALARY+300
---------- ---------2800
3100
4200
4500
4100
4400
3400
3700
3000
3300
3800
4100
3600
3900
13000
13300
12000
12300
4000
4300
3900
4200
SQL> select SALARY, salary*Commission_pct from employees;
SALARY SALARY*COMMISSION_PCT
---------- --------------------2800
4200
4100
3400
3000
3800
3600
13000
--ALIAS
SQL>select salary, salary*commission_pct INCR from employees;
SALARY
INCR
---------- ---------3100
2600
2500
14000
5600
13500
4050
12000
3600
11000
3300
10500
2100
10000
3000
9500
2375
9000
2250
SQL>select last_name, 12*salary+100 from employees;

LAST_NAME
12*SALARY+100
------------------------- ------------Hutton
105700
Taylor
103300
Livingston
100900
Grant
84100
Johnson
74500
Taylor
38500
Fleaur
37300
Sullivan
30100

SQL>select last_name,12*(salary+100) from employees;


LAST_NAME
12*(SALARY+100)
------------------------- --------------Hutton
106800
Taylor
104400
Livingston
102000
Grant
85200
Johnson
75600
Taylor
39600
Fleaur
38400
Sullivan
31200
--NULL
SALARY
SALARY*NULL
---------- ------------3200
2800
3100
5000
2600
2600
4400
13000
6000
6500
10000
SQL>select last_name||' '||first_name from employees;
LAST_NAME||''||FIRST_NAME
---------------------------------------------Urman Jose Manuel
Vargas Peter
Vishney Clara
Vollman Shanta
Walsh Alana
Weiss Matthew
Whalen Jennifer
Zlotkey Eleni

SQL>select first_name||' is a '||job_id from employees;


FIRST_NAME||'ISA'||JOB_ID
-----------------------------------Ellen is a SA_REP
Sundar is a SA_REP
Mozhe is a ST_CLERK
David is a IT_PROG
Hermann is a PR_REP
Shelli is a PU_CLERK
Amit is a SA_REP
Elizabeth is a SA_REP
Sarah is a SH_CLERK
SQL>select first_name||q'( is a )'||job_id from employees
FIRST_NAME||Q'(ISA)'||JOB_ID
-----------------------------------Ellen is a SA_REP
Sundar is a SA_REP
Mozhe is a ST_CLERK
David is a IT_PROG
Hermann is a PR_REP

You might also like