Professional Documents
Culture Documents
DEPARTMENT_NAME
-----------------------------Administration
Marketing
Purchasing
Human Resources
Shipping
IT
Public Relations
Sales
Executive
Finance
Accounting
DEPARTMENT_ID
------------120
130
140
150
160
170
180
190
200
210
220
DEPARTMENT_NAME
-----------------------------Treasury
Corporate Tax
Control And Credit
Shareholder Services
Benefits
Manufacturing
Construction
Contracting
Operations
IT Support
NOC
DEPARTMENT_ID
------------230
240
250
260
270
DEPARTMENT_NAME
-----------------------------IT Helpdesk
Government Sales
Retail Sales
Recruiting
Payroll
27 rows selected.
SQL> set pagesize 1000;
SQL> set pagewidth 1000;
SP2-0158: unknown SET option "pagewidth"
SQL> help set
SET
--Sets a system variable to alter the SQL*Plus environment settings
for your current session, for example:
- display width for data
- turn on HTML formatting
In iSQL*Plus, you can also use the System Variables screen to set
system variables.
SET system_variable value
where system_variable and value represent one of the following clauses:
APPI[NFO]{OFF|ON|text}
ARRAY[SIZE] {15|n}
AUTO[COMMIT] {OFF|ON|IMM[EDIATE]|n}
AUTOP[RINT] {OFF|ON}
AUTORECOVERY {ON|OFF}
AUTOT[RACE] {OFF|ON|TRACE[ONLY]}
[EXP[LAIN]] [STAT[ISTICS]]
BLO[CKTERMINATOR] {.|c}
CMDS[EP] {;|c|OFF|ON}
COLSEP {_|text}
COM[PATIBILITY] {V7|V8|NATIVE}
CON[CAT] {.|c|OFF|ON}
COPYC[OMMIT] {0|n}
COPYTYPECHECK {OFF|ON}
DEF[INE] {&|c|OFF|ON}
DESCRIBE [DEPTH {1|n|ALL}]
[LINENUM {ON|OFF}] [INDENT {ON|OFF}]
ECHO {OFF|ON}
*EDITF[ILE] file_name[.ext]
EMB[EDDED] {OFF|ON}
ESC[APE] {\|c|OFF|ON}
FEED[BACK] {6|n|OFF|ON}
FLAGGER {OFF|ENTRY|INTERMED[IATE]|FULL}
*FLU[SH] {OFF|ON}
HEA[DING] {OFF|ON}
HEADS[EP] {||c|OFF|ON}
INSTANCE [instance_path|LOCAL]
LIN[ESIZE] {80|n} ({150|n} iSQL*Plus)
LOBOF[FSET] {n|1}
LOGSOURCE [pathname]
LONG {80|n}
LONGC[HUNKSIZE] {80|n}
MARK[UP] HTML [ON|OFF]
[HEAD text] [BODY text] [TABLE text]
[ENTMAP {ON|OFF}]
[SPOOL {ON|OFF}]
[PRE[FORMAT] {ON|OFF}]
*NEWP[AGE] {1|n|NONE}
NULL text
NUMF[ORMAT] format
NUM[WIDTH] {10|n}
PAGES[IZE] {24|n}
*PAU[SE] {OFF|ON|text}
RECSEP {WR[APPED] |
EA[CH]|OFF}
RECSEPCHAR {_|c}
SERVEROUT[PUT] {OFF|ON}
[SIZE n] [FOR[MAT]
{WRA[PPED] |
WOR[D_WRAPPED] |
TRU[NCATED]}]
*SHIFT[INOUT] {VIS[IBLE] |
INV[ISIBLE]}
*SHOW[MODE] {OFF|ON}
*SQLBL[ANKLINES] {ON|OFF}
SQLC[ASE] {MIX[ED] |
LO[WER] | UP[PER]}
*SQLCO[NTINUE] {> | text}
*SQLN[UMBER] {OFF|ON}
SQLPLUSCOMPAT[IBILITY] {x.y[.z]}
*SQLPRE[FIX] {#|c}
*SQLP[ROMPT] {SQL>|text}
SQLT[ERMINATOR]
{;|c|OFF|ON}
*SUF[FIX] {SQL|text}
TAB {OFF|ON}
TERM[OUT] {OFF|ON}
TI[ME] {OFF|ON}
TIMI[NG] {OFF|ON}
TRIM[OUT] {OFF|ON}
TRIMS[POOL] {ON|OFF}
UND[ERLINE] {-|c|ON|OFF}
VER[IFY] {OFF|ON}
WRA[P] {OFF|ON}
EMAIL
--------------------SKING
NKOCHHAR
515.123.4568
102 Lex
515.123.4569
103 Alexander
590.423.4567
108 Nancy
515.124.4569
109 Daniel
515.124.4169
110 John
515.124.4269
114 Den
515.127.4561
121 Adam
650.123.2234
145 John
011.44.1344.429268
146 Karen
011.44.1344.467268
147 Alberto
011.44.1344.429278
148 Gerald
011.44.1344.619268
149 Eleni
011.44.1344.429018
150 Peter
011.44.1344.129268
151 David
011.44.1344.345268
152 Peter
011.44.1344.478968
156 Janette
011.44.1345.429268
157 Patrick
011.44.1345.929268
158 Allan
011.44.1345.829268
162 Clara
011.44.1346.129268
163 Danielle
011.44.1346.229268
168 Lisa
011.44.1343.929268
169 Harrison
011.44.1343.829268
170 Tayler
011.44.1343.729268
174 Ellen
011.44.1644.429267
175 Alyssa
011.44.1644.429266
176 Jonathon
011.44.1644.429265
177 Jack
011.44.1644.429264
201 Michael
515.123.5555
204 Hermann
515.123.8888
205 Shelley
21-SEP-89 AD_VP
De Haan
13-JAN-93 AD_VP
Hunold
03-JAN-90 IT_PROG
Greenberg
17-AUG-94 FI_MGR
Faviet
16-AUG-94 FI_ACCOUN
Chen
28-SEP-97 FI_ACCOUN
Raphaely
07-DEC-94 PU_MAN
Fripp
10-APR-97 ST_MAN
Russell
01-OCT-96 SA_MAN
Partners
05-JAN-97 SA_MAN
Errazuriz
10-MAR-97 SA_MAN
Cambrault
15-OCT-99 SA_MAN
Zlotkey
29-JAN-00 SA_MAN
Tucker
30-JAN-97 SA_REP
Bernstein
24-MAR-97 SA_REP
Hall
20-AUG-97 SA_REP
King
30-JAN-96 SA_REP
Sully
04-MAR-96 SA_REP
McEwen
01-AUG-96 SA_REP
Vishney
11-NOV-97 SA_REP
Greene
19-MAR-99 SA_REP
Ozer
11-MAR-97 SA_REP
Bloom
23-MAR-98 SA_REP
Fox
24-JAN-98 SA_REP
Abel
11-MAY-96 SA_REP
Hutton
19-MAR-97 SA_REP
Taylor
24-MAR-98 SA_REP
Livingston
23-APR-98 SA_REP
Hartstein
17-FEB-96 MK_MAN
Baer
07-JUN-94 PR_REP
Higgins
LDEHAAN
AHUNOLD
NGREENBE
DFAVIET
JCHEN
DRAPHEAL
AFRIPP
JRUSSEL
KPARTNER
AERRAZUR
GCAMBRAU
EZLOTKEY
PTUCKER
DBERNSTE
PHALL
JKING
PSULLY
AMCEWEN
CVISHNEY
DGREENE
LOZER
HBLOOM
TFOX
EABEL
AHUTTON
JTAYLOR
JLIVINGS
MHARTSTE
HBAER
SHIGGINS
515.123.8080
206 William
515.123.8181
07-JUN-94 AC_MGR
Gietz
07-JUN-94 AC_ACCOUN
WGIETZ
33 rows selected.
SQL>
Atkinson
Marlow
Olson
Mallin
Rogers
Gee
Philtanker
Ladwig
Stiles
Seo
Patel
Rajs
Davies
Matos
Vargas
Taylor
Fleaur
Sullivan
Geoni
Sarchand
Bull
Dellinger
Cabrio
Chung
Dilly
Gates
Perkins
Bell
Everett
McCain
Jones
Walsh
Feeney
OConnell
Grant
Whalen
Hartstein
Fay
Mavris
Baer
Higgins
Gietz
72 rows selected.
SQL> -aliases
SP2-0042: unknown command "-aliases" - rest of line ignored.
SQL>
SQL> --aliases
SQL> select last_name,salary,commission_pct commission from employees where comm
ission is not null;
select last_name,salary,commission_pct commission from employees where commissio
n is not null
*
ERROR at line 1:
ORA-00904: "COMMISSION": invalid identifier
SQL> ed
Wrote file afiedt.buf
ERROR at line 1:
ORA-00904: "COMMISSION": invalid identifier
SQL> ed
Wrote file afiedt.buf
1* select last_name name,salary Salary,commission_pct comm from employees wher
e commission is not
SQL> /
select last_name name,salary Salary,commission_pct comm from employees where com
mission is not null
*
ERROR at line 1:
ORA-00904: "COMMISSION": invalid identifier
SQL> ed
Wrote file afiedt.buf
1* select last_name name,salary Salary,commission_pct comm from employees wher
e commission_pct is
SQL> /
NAME
SALARY
COMM
------------------------- ---------- ---------Russell
14000
.4
Partners
13500
.3
Errazuriz
12000
.3
Cambrault
11000
.3
Zlotkey
10500
.2
Tucker
10000
.3
Bernstein
9500
.25
Hall
9000
.25
Olsen
8000
.2
Cambrault
7500
.2
Tuvault
7000
.15
King
10000
.35
Sully
9500
.35
McEwen
9000
.35
Smith
8000
.3
Doran
7500
.3
Sewall
7000
.25
Vishney
10500
.25
Greene
9500
.15
Marvins
7200
.1
Lee
6800
.1
Ande
6400
.1
Banda
6200
.1
Ozer
11500
.25
Bloom
10000
.2
Fox
9600
.2
Smith
7400
.15
Bates
7300
.15
Kumar
6100
.1
Abel
11000
.3
Hutton
8800
.25
Taylor
8600
.2
Livingston
8400
.2
Grant
7000
.15
Johnson
6200
.1
35 rows selected.
SQL> ed
Wrote file afiedt.buf
1* select last_name name,salary Salary,commission_pct comm from employees wher
e commission_pct is
SQL> select last_name,salary*12 "annual salary" from employees
2 ;
LAST_NAME
annual salary
------------------------- ------------King
288000
Kochhar
204000
De Haan
204000
Hunold
108000
Ernst
72000
Austin
57600
Pataballa
57600
Lorentz
50400
Greenberg
144000
Faviet
108000
Chen
98400
Sciarra
92400
Urman
93600
Popp
82800
Raphaely
132000
Khoo
37200
Baida
34800
Tobias
33600
Himuro
31200
Colmenares
30000
Weiss
96000
Fripp
98400
Kaufling
94800
Vollman
78000
Mourgos
69600
Nayer
38400
Mikkilineni
32400
Landry
28800
Markle
26400
Bissot
39600
Atkinson
33600
Marlow
30000
Olson
25200
Mallin
39600
Rogers
34800
Gee
28800
Philtanker
26400
Ladwig
43200
Stiles
38400
Seo
32400
Patel
30000
Rajs
42000
Davies
37200
Matos
31200
Vargas
30000
Russell
168000
Partners
Errazuriz
Cambrault
Zlotkey
Tucker
Bernstein
Hall
Olsen
Cambrault
Tuvault
King
Sully
McEwen
Smith
Doran
Sewall
Vishney
Greene
Marvins
Lee
Ande
Banda
Ozer
Bloom
Fox
Smith
Bates
Kumar
Abel
Hutton
Taylor
Livingston
Grant
Johnson
Taylor
Fleaur
Sullivan
Geoni
Sarchand
Bull
Dellinger
Cabrio
Chung
Dilly
Gates
Perkins
Bell
Everett
McCain
Jones
Walsh
Feeney
OConnell
Grant
Whalen
Hartstein
Fay
Mavris
Baer
Higgins
162000
144000
132000
126000
120000
114000
108000
96000
90000
84000
120000
114000
108000
96000
90000
84000
126000
114000
86400
81600
76800
74400
138000
120000
115200
88800
87600
73200
132000
105600
103200
100800
84000
74400
38400
37200
30000
33600
50400
49200
40800
36000
45600
43200
34800
30000
48000
46800
38400
33600
37200
36000
31200
31200
52800
156000
72000
78000
120000
144000
Gietz
99600
DavidBernstein
PeterHall
ChristopherOlsen
NanetteCambrault
OliverTuvault
JanetteKing
PatrickSully
AllanMcEwen
LindseySmith
LouiseDoran
SarathSewall
ClaraVishney
DanielleGreene
MatteaMarvins
DavidLee
SundarAnde
AmitBanda
LisaOzer
HarrisonBloom
TaylerFox
WilliamSmith
ElizabethBates
SunditaKumar
EllenAbel
AlyssaHutton
JonathonTaylor
JackLivingston
KimberelyGrant
CharlesJohnson
WinstonTaylor
JeanFleaur
MarthaSullivan
GirardGeoni
NanditaSarchand
AlexisBull
JuliaDellinger
AnthonyCabrio
KellyChung
JenniferDilly
TimothyGates
RandallPerkins
SarahBell
BritneyEverett
SamuelMcCain
VanceJones
AlanaWalsh
KevinFeeney
DonaldOConnell
DouglasGrant
JenniferWhalen
MichaelHartstein
PatFay
SusanMavris
HermannBaer
ShelleyHiggins
WilliamGietz
107 rows selected.
SQL> --literal strings
Janette King
Patrick Sully
Allan McEwen
Lindsey Smith
Louise Doran
Sarath Sewall
Clara Vishney
Danielle Greene
Mattea Marvins
David Lee
Sundar Ande
Amit Banda
Lisa Ozer
Harrison Bloom
Tayler Fox
William Smith
Elizabeth Bates
Sundita Kumar
Ellen Abel
Alyssa Hutton
Jonathon Taylor
Jack Livingston
Kimberely Grant
Charles Johnson
Winston Taylor
Jean Fleaur
Martha Sullivan
Girard Geoni
Nandita Sarchand
Alexis Bull
Julia Dellinger
Anthony Cabrio
Kelly Chung
Jennifer Dilly
Timothy Gates
Randall Perkins
Sarah Bell
Britney Everett
Samuel McCain
Vance Jones
Alana Walsh
Kevin Feeney
Donald OConnell
Douglas Grant
Jennifer Whalen
Michael Hartstein
Pat Fay
Susan Mavris
Hermann Baer
Shelley Higgins
William Gietz
107 rows selected.
SQL> --eliminating duplicate rows
SQL> select distinct department_id from employees;
DEPARTMENT_ID
------------10
20
30
40
50
60
70
80
90
100
110
12 rows selected.
SQL> --describing structures of table
SQL> desc employees;
Name
Null?
T
-------------------------------------------------------------------------------------------------EMPLOYEE_ID
NOT NULL N
FIRST_NAME
V
LAST_NAME
NOT NULL V
EMAIL
NOT NULL V
PHONE_NUMBER
V
HIRE_DATE
NOT NULL D
JOB_ID
NOT NULL V
SALARY
N
COMMISSION_PCT
N
MANAGER_ID
N
DEPARTMENT_ID
N
SQL> SELECT employee_id, last_name
2 sal x 12 ANNUAL SALARY
3 FROM employees;
sal x 12 ANNUAL SALARY
*
ERROR at line 2:
ORA-00923: FROM keyword not found where expected
SQL> ed
Wrote file afiedt.buf
1 SELECT employee_id, last_name
2 sal * 12 ANNUAL SALARY
3* FROM employees
SQL> /
sal * 12 ANNUAL SALARY
*
ERROR at line 2:
ORA-00923: FROM keyword not found where expected
SQL> ed
Wrote file afiedt.buf
1 SELECT employee_id, last_name,
2 sal * 12 ANNUAL SALARY
3* FROM employees
SQL> /
sal * 12 ANNUAL SALARY
*
ERROR at line 2:
ORA-00923: FROM keyword not found where expected
SQL> ed
Wrote file afiedt.buf
1
2
3*
SQL>
EMPLOYEE_ID
----------100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
LAST_NAME
ANNUAL SALARY
------------------------- ------------King
288000
Kochhar
204000
De Haan
204000
Hunold
108000
Ernst
72000
Austin
57600
Pataballa
57600
Lorentz
50400
Greenberg
144000
Faviet
108000
Chen
98400
Sciarra
92400
Urman
93600
Popp
82800
Raphaely
132000
Khoo
37200
Baida
34800
Tobias
33600
Himuro
31200
Colmenares
30000
Weiss
96000
Fripp
98400
Kaufling
94800
Vollman
78000
Mourgos
69600
Nayer
38400
Mikkilineni
32400
Landry
28800
Markle
26400
Bissot
39600
Atkinson
33600
Marlow
30000
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
Olson
Mallin
Rogers
Gee
Philtanker
Ladwig
Stiles
Seo
Patel
Rajs
Davies
Matos
Vargas
Russell
Partners
Errazuriz
Cambrault
Zlotkey
Tucker
Bernstein
Hall
Olsen
Cambrault
Tuvault
King
Sully
McEwen
Smith
Doran
Sewall
Vishney
Greene
Marvins
Lee
Ande
Banda
Ozer
Bloom
Fox
Smith
Bates
Kumar
Abel
Hutton
Taylor
Livingston
Grant
Johnson
Taylor
Fleaur
Sullivan
Geoni
Sarchand
Bull
Dellinger
Cabrio
Chung
Dilly
Gates
Perkins
25200
39600
34800
28800
26400
43200
38400
32400
30000
42000
37200
31200
30000
168000
162000
144000
132000
126000
120000
114000
108000
96000
90000
84000
120000
114000
108000
96000
90000
84000
126000
114000
86400
81600
76800
74400
138000
120000
115200
88800
87600
73200
132000
105600
103200
100800
84000
74400
38400
37200
30000
33600
50400
49200
40800
36000
45600
43200
34800
30000
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
Bell
Everett
McCain
Jones
Walsh
Feeney
OConnell
Grant
Whalen
Hartstein
Fay
Mavris
Baer
Higgins
Gietz
48000
46800
38400
33600
37200
36000
31200
31200
52800
156000
72000
78000
120000
144000
99600
DEPARTMENT_NAME
MANAGER_ID LOCATION_ID
------------------------------ ---------- ----------Administration
200
1700
Marketing
201
1800
Purchasing
114
1700
Human Resources
203
2400
Shipping
121
1500
IT
103
1400
Public Relations
204
2700
Sales
145
2500
Executive
100
1700
Finance
108
1700
Accounting
205
1700
Treasury
1700
Corporate Tax
1700
Control And Credit
1700
Shareholder Services
1700
Benefits
1700
Manufacturing
1700
Construction
1700
Contracting
1700
Operations
1700
IT Support
1700
NOC
1700
230
240
250
260
270
IT Helpdesk
Government Sales
Retail Sales
Recruiting
Payroll
1700
1700
1700
1700
1700
27 rows selected.
SQL> --7:
SQL> desc employees;
Name
Null?
T
-------------------------------------------------------------------------------------------------EMPLOYEE_ID
NOT NULL N
FIRST_NAME
V
LAST_NAME
NOT NULL V
EMAIL
NOT NULL V
PHONE_NUMBER
V
HIRE_DATE
NOT NULL D
JOB_ID
NOT NULL V
SALARY
N
COMMISSION_PCT
N
MANAGER_ID
N
DEPARTMENT_ID
N
SQL> select last_name Name,job_code,hire_date "Start Date",employee_id from empl
oyees;
select last_name Name,job_code,hire_date "Start Date",employee_id from employees
*
ERROR at line 1:
ORA-00904: "JOB_CODE": invalid identifier
SQL> ed
Wrote file afiedt.buf
1* select employee_id,last_name Name,job_id,hire_date "Start Date" from employ
ees
SQL> /
EMPLOYEE_ID
----------100
101
102
103
104
105
NAME
------------------------King
Kochhar
De Haan
Hunold
Ernst
Austin
JOB_ID
---------AD_PRES
AD_VP
AD_VP
IT_PROG
IT_PROG
IT_PROG
Start Dat
--------17-JUN-87
21-SEP-89
13-JAN-93
03-JAN-90
21-MAY-91
25-JUN-97
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
Pataballa
Lorentz
Greenberg
Faviet
Chen
Sciarra
Urman
Popp
Raphaely
Khoo
Baida
Tobias
Himuro
Colmenares
Weiss
Fripp
Kaufling
Vollman
Mourgos
Nayer
Mikkilineni
Landry
Markle
Bissot
Atkinson
Marlow
Olson
Mallin
Rogers
Gee
Philtanker
Ladwig
Stiles
Seo
Patel
Rajs
Davies
Matos
Vargas
Russell
Partners
Errazuriz
Cambrault
Zlotkey
Tucker
Bernstein
Hall
Olsen
Cambrault
Tuvault
King
Sully
McEwen
Smith
Doran
Sewall
Vishney
Greene
Marvins
Lee
IT_PROG
IT_PROG
FI_MGR
FI_ACCOUNT
FI_ACCOUNT
FI_ACCOUNT
FI_ACCOUNT
FI_ACCOUNT
PU_MAN
PU_CLERK
PU_CLERK
PU_CLERK
PU_CLERK
PU_CLERK
ST_MAN
ST_MAN
ST_MAN
ST_MAN
ST_MAN
ST_CLERK
ST_CLERK
ST_CLERK
ST_CLERK
ST_CLERK
ST_CLERK
ST_CLERK
ST_CLERK
ST_CLERK
ST_CLERK
ST_CLERK
ST_CLERK
ST_CLERK
ST_CLERK
ST_CLERK
ST_CLERK
ST_CLERK
ST_CLERK
ST_CLERK
ST_CLERK
SA_MAN
SA_MAN
SA_MAN
SA_MAN
SA_MAN
SA_REP
SA_REP
SA_REP
SA_REP
SA_REP
SA_REP
SA_REP
SA_REP
SA_REP
SA_REP
SA_REP
SA_REP
SA_REP
SA_REP
SA_REP
SA_REP
05-FEB-98
07-FEB-99
17-AUG-94
16-AUG-94
28-SEP-97
30-SEP-97
07-MAR-98
07-DEC-99
07-DEC-94
18-MAY-95
24-DEC-97
24-JUL-97
15-NOV-98
10-AUG-99
18-JUL-96
10-APR-97
01-MAY-95
10-OCT-97
16-NOV-99
16-JUL-97
28-SEP-98
14-JAN-99
08-MAR-00
20-AUG-97
30-OCT-97
16-FEB-97
10-APR-99
14-JUN-96
26-AUG-98
12-DEC-99
06-FEB-00
14-JUL-95
26-OCT-97
12-FEB-98
06-APR-98
17-OCT-95
29-JAN-97
15-MAR-98
09-JUL-98
01-OCT-96
05-JAN-97
10-MAR-97
15-OCT-99
29-JAN-00
30-JAN-97
24-MAR-97
20-AUG-97
30-MAR-98
09-DEC-98
23-NOV-99
30-JAN-96
04-MAR-96
01-AUG-96
10-MAR-97
15-DEC-97
03-NOV-98
11-NOV-97
19-MAR-99
24-JAN-00
23-FEB-00
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
Ande
Banda
Ozer
Bloom
Fox
Smith
Bates
Kumar
Abel
Hutton
Taylor
Livingston
Grant
Johnson
Taylor
Fleaur
Sullivan
Geoni
Sarchand
Bull
Dellinger
Cabrio
Chung
Dilly
Gates
Perkins
Bell
Everett
McCain
Jones
Walsh
Feeney
OConnell
Grant
Whalen
Hartstein
Fay
Mavris
Baer
Higgins
Gietz
SA_REP
SA_REP
SA_REP
SA_REP
SA_REP
SA_REP
SA_REP
SA_REP
SA_REP
SA_REP
SA_REP
SA_REP
SA_REP
SA_REP
SH_CLERK
SH_CLERK
SH_CLERK
SH_CLERK
SH_CLERK
SH_CLERK
SH_CLERK
SH_CLERK
SH_CLERK
SH_CLERK
SH_CLERK
SH_CLERK
SH_CLERK
SH_CLERK
SH_CLERK
SH_CLERK
SH_CLERK
SH_CLERK
SH_CLERK
SH_CLERK
AD_ASST
MK_MAN
MK_REP
HR_REP
PR_REP
AC_MGR
AC_ACCOUNT
24-MAR-00
21-APR-00
11-MAR-97
23-MAR-98
24-JAN-98
23-FEB-99
24-MAR-99
21-APR-00
11-MAY-96
19-MAR-97
24-MAR-98
23-APR-98
24-MAY-99
04-JAN-00
24-JAN-98
23-FEB-98
21-JUN-99
03-FEB-00
27-JAN-96
20-FEB-97
24-JUN-98
07-FEB-99
14-JUN-97
13-AUG-97
11-JUL-98
19-DEC-99
04-FEB-96
03-MAR-97
01-JUL-98
17-MAR-99
24-APR-98
23-MAY-98
21-JUN-99
13-JAN-00
17-SEP-87
17-FEB-96
17-AUG-97
07-JUN-94
07-JUN-94
07-JUN-94
07-JUN-94
EMAIL
--------------------SKING
NKOCHHAR
LDEHAAN
AHUNOLD
NGREENBE
515.124.4569
109 Daniel
515.124.4169
110 John
515.124.4269
114 Den
515.127.4561
121 Adam
650.123.2234
145 John
011.44.1344.429268
146 Karen
011.44.1344.467268
147 Alberto
011.44.1344.429278
148 Gerald
011.44.1344.619268
149 Eleni
011.44.1344.429018
150 Peter
011.44.1344.129268
151 David
011.44.1344.345268
152 Peter
011.44.1344.478968
156 Janette
011.44.1345.429268
157 Patrick
011.44.1345.929268
158 Allan
011.44.1345.829268
162 Clara
011.44.1346.129268
163 Danielle
011.44.1346.229268
168 Lisa
011.44.1343.929268
169 Harrison
011.44.1343.829268
170 Tayler
011.44.1343.729268
174 Ellen
011.44.1644.429267
175 Alyssa
011.44.1644.429266
176 Jonathon
011.44.1644.429265
177 Jack
011.44.1644.429264
201 Michael
515.123.5555
204 Hermann
515.123.8888
205 Shelley
515.123.8080
206 William
515.123.8181
33 rows selected.
17-AUG-94 FI_MGR
Faviet
16-AUG-94 FI_ACCOUN
Chen
28-SEP-97 FI_ACCOUN
Raphaely
07-DEC-94 PU_MAN
Fripp
10-APR-97 ST_MAN
Russell
01-OCT-96 SA_MAN
Partners
05-JAN-97 SA_MAN
Errazuriz
10-MAR-97 SA_MAN
Cambrault
15-OCT-99 SA_MAN
Zlotkey
29-JAN-00 SA_MAN
Tucker
30-JAN-97 SA_REP
Bernstein
24-MAR-97 SA_REP
Hall
20-AUG-97 SA_REP
King
30-JAN-96 SA_REP
Sully
04-MAR-96 SA_REP
McEwen
01-AUG-96 SA_REP
Vishney
11-NOV-97 SA_REP
Greene
19-MAR-99 SA_REP
Ozer
11-MAR-97 SA_REP
Bloom
23-MAR-98 SA_REP
Fox
24-JAN-98 SA_REP
Abel
11-MAY-96 SA_REP
Hutton
19-MAR-97 SA_REP
Taylor
24-MAR-98 SA_REP
Livingston
23-APR-98 SA_REP
Hartstein
17-FEB-96 MK_MAN
Baer
07-JUN-94 PR_REP
Higgins
07-JUN-94 AC_MGR
Gietz
07-JUN-94 AC_ACCOUN
DFAVIET
JCHEN
DRAPHEAL
AFRIPP
JRUSSEL
KPARTNER
AERRAZUR
GCAMBRAU
EZLOTKEY
PTUCKER
DBERNSTE
PHALL
JKING
PSULLY
AMCEWEN
CVISHNEY
DGREENE
LOZER
HBLOOM
TFOX
EABEL
AHUTTON
JTAYLOR
JLIVINGS
MHARTSTE
HBAER
SHIGGINS
WGIETZ
SQL>
Philtanker
Ladwig
Stiles
Seo
Patel
Rajs
Davies
Matos
Vargas
Taylor
Fleaur
Sullivan
Geoni
Sarchand
Bull
Dellinger
Cabrio
Chung
Dilly
Gates
Perkins
Bell
Everett
McCain
Jones
Walsh
Feeney
OConnell
Grant
Whalen
Hartstein
Fay
Mavris
Baer
Higgins
Gietz
72 rows selected.
SQL> -aliases
SP2-0042: unknown command "-aliases" - rest of line ignored.
SQL>
SQL> --aliases
SQL> select last_name,salary,commission_pct commission from employees where comm
ission is not null;
select last_name,salary,commission_pct commission from employees where commissio
n is not null
*
ERROR at line 1:
ORA-00904: "COMMISSION": invalid identifier
SQL> ed
Wrote file afiedt.buf
1* select last_name,salary,commission_pct as commission from employees where c
ommission is not nul
SQL> /
select last_name,salary,commission_pct as commission from employees where commis
sion is not null
*
ERROR at line 1:
ORA-00904: "COMMISSION": invalid identifier
SQL> ed
Wrote file afiedt.buf
1* select last_name,salary,commission_pct "commission" from employees where co
mmission is not null
SQL> /
select last_name,salary,commission_pct "commission" from employees where commiss
ion is not null
*
ERROR at line 1:
ORA-00904: "COMMISSION": invalid identifier
SQL> ed
Wrote file afiedt.buf
1* select last_name,salary,commission_pct as commission from employees where c
ommission is not nul
SQL> /
select last_name,salary,commission_pct as commission from employees where commis
sion is not null
*
ERROR at line 1:
ORA-00904: "COMMISSION": invalid identifier
SQL> ed
Wrote file afiedt.buf
1* select last_name,salary,commission_pct commission from employees where comm
ission is not null
SQL> /
select last_name,salary,commission_pct commission from employees where commissio
n is not null
*
ERROR at line 1:
ORA-00904: "COMMISSION": invalid identifier
SQL> ed
Wrote file afiedt.buf
1* select last_name name,salary Salary,commission_pct commission from employee
s where commission i
SQL> /
select last_name name,salary Salary,commission_pct commission from employees whe
re commission is not
*
ERROR at line 1:
ORA-00904: "COMMISSION": invalid identifier
SQL> ed
Wrote file afiedt.buf
Hall
Olsen
Cambrault
Tuvault
King
Sully
McEwen
Smith
Doran
Sewall
Vishney
Greene
Marvins
Lee
Ande
Banda
Ozer
Bloom
Fox
Smith
Bates
Kumar
Abel
Hutton
Taylor
Livingston
Grant
Johnson
Taylor
Fleaur
Sullivan
Geoni
Sarchand
Bull
Dellinger
Cabrio
Chung
Dilly
Gates
Perkins
Bell
Everett
McCain
Jones
Walsh
Feeney
OConnell
Grant
Whalen
Hartstein
Fay
Mavris
Baer
Higgins
Gietz
108000
96000
90000
84000
120000
114000
108000
96000
90000
84000
126000
114000
86400
81600
76800
74400
138000
120000
115200
88800
87600
73200
132000
105600
103200
100800
84000
74400
38400
37200
30000
33600
50400
49200
40800
36000
45600
43200
34800
30000
48000
46800
38400
33600
37200
36000
31200
31200
52800
156000
72000
78000
120000
144000
99600
NAME
--------------------------------------------StevenKing
NeenaKochhar
LexDe Haan
AlexanderHunold
BruceErnst
DavidAustin
ValliPataballa
DianaLorentz
NancyGreenberg
DanielFaviet
JohnChen
IsmaelSciarra
Jose ManuelUrman
LuisPopp
DenRaphaely
AlexanderKhoo
ShelliBaida
SigalTobias
GuyHimuro
KarenColmenares
MatthewWeiss
AdamFripp
PayamKaufling
ShantaVollman
KevinMourgos
JuliaNayer
IreneMikkilineni
JamesLandry
StevenMarkle
LauraBissot
MozheAtkinson
JamesMarlow
TJOlson
JasonMallin
MichaelRogers
KiGee
HazelPhiltanker
RenskeLadwig
StephenStiles
JohnSeo
JoshuaPatel
TrennaRajs
CurtisDavies
RandallMatos
PeterVargas
JohnRussell
KarenPartners
AlbertoErrazuriz
GeraldCambrault
EleniZlotkey
PeterTucker
DavidBernstein
PeterHall
ChristopherOlsen
NanetteCambrault
OliverTuvault
JanetteKing
PatrickSully
AllanMcEwen
LindseySmith
LouiseDoran
SarathSewall
ClaraVishney
DanielleGreene
MatteaMarvins
DavidLee
SundarAnde
AmitBanda
LisaOzer
HarrisonBloom
TaylerFox
WilliamSmith
ElizabethBates
SunditaKumar
EllenAbel
AlyssaHutton
JonathonTaylor
JackLivingston
KimberelyGrant
CharlesJohnson
WinstonTaylor
JeanFleaur
MarthaSullivan
GirardGeoni
NanditaSarchand
AlexisBull
JuliaDellinger
AnthonyCabrio
KellyChung
JenniferDilly
TimothyGates
RandallPerkins
SarahBell
BritneyEverett
SamuelMcCain
VanceJones
AlanaWalsh
KevinFeeney
DonaldOConnell
DouglasGrant
JenniferWhalen
MichaelHartstein
PatFay
SusanMavris
HermannBaer
ShelleyHiggins
WilliamGietz
107 rows selected.
SQL> --literal strings
SQL> select first_name||' '||last_name from employees;
FIRST_NAME||''||LAST_NAME
---------------------------------------------Steven King
Neena Kochhar
Lex De Haan
Alexander Hunold
Bruce Ernst
David Austin
Valli Pataballa
Diana Lorentz
Nancy Greenberg
Daniel Faviet
John Chen
Ismael Sciarra
Jose Manuel Urman
Luis Popp
Den Raphaely
Alexander Khoo
Shelli Baida
Sigal Tobias
Guy Himuro
Karen Colmenares
Matthew Weiss
Adam Fripp
Payam Kaufling
Shanta Vollman
Kevin Mourgos
Julia Nayer
Irene Mikkilineni
James Landry
Steven Markle
Laura Bissot
Mozhe Atkinson
James Marlow
TJ Olson
Jason Mallin
Michael Rogers
Ki Gee
Hazel Philtanker
Renske Ladwig
Stephen Stiles
John Seo
Joshua Patel
Trenna Rajs
Curtis Davies
Randall Matos
Peter Vargas
John Russell
Karen Partners
Alberto Errazuriz
Gerald Cambrault
Eleni Zlotkey
Peter Tucker
David Bernstein
Peter Hall
Christopher Olsen
Nanette Cambrault
Oliver Tuvault
Janette King
Patrick Sully
Allan McEwen
Lindsey Smith
Louise Doran
Sarath Sewall
Clara Vishney
Danielle Greene
Mattea Marvins
David Lee
Sundar Ande
Amit Banda
Lisa Ozer
Harrison Bloom
Tayler Fox
William Smith
Elizabeth Bates
Sundita Kumar
Ellen Abel
Alyssa Hutton
Jonathon Taylor
Jack Livingston
Kimberely Grant
Charles Johnson
Winston Taylor
Jean Fleaur
Martha Sullivan
Girard Geoni
Nandita Sarchand
Alexis Bull
Julia Dellinger
Anthony Cabrio
Kelly Chung
Jennifer Dilly
Timothy Gates
Randall Perkins
Sarah Bell
Britney Everett
Samuel McCain
Vance Jones
Alana Walsh
Kevin Feeney
Donald OConnell
Douglas Grant
Jennifer Whalen
Michael Hartstein
Pat Fay
Susan Mavris
Hermann Baer
Shelley Higgins
William Gietz
107 rows selected.
SQL> --eliminating duplicate rows
SQL> select distinct department_id from employees;
DEPARTMENT_ID
------------10
20
30
40
50
60
70
80
90
100
110
12 rows selected.
SQL> --describing structures of table
SQL> desc employees;
Name
Null?
T
-------------------------------------------------------------------------------------------------EMPLOYEE_ID
NOT NULL N
FIRST_NAME
V
LAST_NAME
NOT NULL V
EMAIL
NOT NULL V
PHONE_NUMBER
V
HIRE_DATE
NOT NULL D
JOB_ID
NOT NULL V
SALARY
N
COMMISSION_PCT
N
MANAGER_ID
N
DEPARTMENT_ID
N
SQL> SELECT employee_id, last_name
2 sal x 12 ANNUAL SALARY
3 FROM employees;
sal x 12 ANNUAL SALARY
*
ERROR at line 2:
ORA-00923: FROM keyword not found where expected
SQL> ed
Wrote file afiedt.buf
1 SELECT employee_id, last_name
2 sal * 12 ANNUAL SALARY
3* FROM employees
SQL> /
sal * 12 ANNUAL SALARY
*
ERROR at line 2:
ORA-00923: FROM keyword not found where expected
SQL> ed
EMPLOYEE_ID
----------100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
LAST_NAME
ANNUAL SALARY
------------------------- ------------King
288000
Kochhar
204000
De Haan
204000
Hunold
108000
Ernst
72000
Austin
57600
Pataballa
57600
Lorentz
50400
Greenberg
144000
Faviet
108000
Chen
98400
Sciarra
92400
Urman
93600
Popp
82800
Raphaely
132000
Khoo
37200
Baida
34800
Tobias
33600
Himuro
31200
Colmenares
30000
Weiss
96000
Fripp
98400
Kaufling
94800
Vollman
78000
Mourgos
69600
Nayer
38400
Mikkilineni
32400
Landry
28800
Markle
26400
Bissot
39600
Atkinson
33600
Marlow
30000
Olson
25200
Mallin
39600
Rogers
34800
Gee
28800
Philtanker
26400
Ladwig
43200
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
Stiles
Seo
Patel
Rajs
Davies
Matos
Vargas
Russell
Partners
Errazuriz
Cambrault
Zlotkey
Tucker
Bernstein
Hall
Olsen
Cambrault
Tuvault
King
Sully
McEwen
Smith
Doran
Sewall
Vishney
Greene
Marvins
Lee
Ande
Banda
Ozer
Bloom
Fox
Smith
Bates
Kumar
Abel
Hutton
Taylor
Livingston
Grant
Johnson
Taylor
Fleaur
Sullivan
Geoni
Sarchand
Bull
Dellinger
Cabrio
Chung
Dilly
Gates
Perkins
Bell
Everett
McCain
Jones
Walsh
Feeney
38400
32400
30000
42000
37200
31200
30000
168000
162000
144000
132000
126000
120000
114000
108000
96000
90000
84000
120000
114000
108000
96000
90000
84000
126000
114000
86400
81600
76800
74400
138000
120000
115200
88800
87600
73200
132000
105600
103200
100800
84000
74400
38400
37200
30000
33600
50400
49200
40800
36000
45600
43200
34800
30000
48000
46800
38400
33600
37200
36000
198
199
200
201
202
203
204
205
206
OConnell
Grant
Whalen
Hartstein
Fay
Mavris
Baer
Higgins
Gietz
31200
31200
52800
156000
72000
78000
120000
144000
99600
DEPARTMENT_NAME
MANAGER_ID LOCATION_ID
------------------------------ ---------- ----------Administration
200
1700
Marketing
201
1800
Purchasing
114
1700
Human Resources
203
2400
Shipping
121
1500
IT
103
1400
Public Relations
204
2700
Sales
145
2500
Executive
100
1700
Finance
108
1700
Accounting
205
1700
Treasury
1700
Corporate Tax
1700
Control And Credit
1700
Shareholder Services
1700
Benefits
1700
Manufacturing
1700
Construction
1700
Contracting
1700
Operations
1700
IT Support
1700
NOC
1700
IT Helpdesk
1700
Government Sales
1700
Retail Sales
1700
Recruiting
1700
Payroll
1700
27 rows selected.
SQL> --7:
SQL> desc employees;
Name
Null?
T
-------------------------------------------------------------------------------------------------EMPLOYEE_ID
NOT NULL N
FIRST_NAME
V
LAST_NAME
NOT NULL V
EMAIL
NOT NULL V
PHONE_NUMBER
V
HIRE_DATE
NOT NULL D
JOB_ID
NOT NULL V
SALARY
N
COMMISSION_PCT
N
MANAGER_ID
N
DEPARTMENT_ID
N
SQL> select last_name Name,job_code,hire_date "Start Date",employee_id from empl
oyees;
select last_name Name,job_code,hire_date "Start Date",employee_id from employees
*
ERROR at line 1:
ORA-00904: "JOB_CODE": invalid identifier
SQL> ed
Wrote file afiedt.buf
1* select employee_id,last_name Name,job_id,hire_date "Start Date" from employ
ees
SQL> /
EMPLOYEE_ID
----------100
101
102
103
104
105
106
107
108
109
110
111
NAME
------------------------King
Kochhar
De Haan
Hunold
Ernst
Austin
Pataballa
Lorentz
Greenberg
Faviet
Chen
Sciarra
JOB_ID
---------AD_PRES
AD_VP
AD_VP
IT_PROG
IT_PROG
IT_PROG
IT_PROG
IT_PROG
FI_MGR
FI_ACCOUNT
FI_ACCOUNT
FI_ACCOUNT
Start Dat
--------17-JUN-87
21-SEP-89
13-JAN-93
03-JAN-90
21-MAY-91
25-JUN-97
05-FEB-98
07-FEB-99
17-AUG-94
16-AUG-94
28-SEP-97
30-SEP-97
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
Urman
Popp
Raphaely
Khoo
Baida
Tobias
Himuro
Colmenares
Weiss
Fripp
Kaufling
Vollman
Mourgos
Nayer
Mikkilineni
Landry
Markle
Bissot
Atkinson
Marlow
Olson
Mallin
Rogers
Gee
Philtanker
Ladwig
Stiles
Seo
Patel
Rajs
Davies
Matos
Vargas
Russell
Partners
Errazuriz
Cambrault
Zlotkey
Tucker
Bernstein
Hall
Olsen
Cambrault
Tuvault
King
Sully
McEwen
Smith
Doran
Sewall
Vishney
Greene
Marvins
Lee
Ande
Banda
Ozer
Bloom
Fox
Smith
FI_ACCOUNT
FI_ACCOUNT
PU_MAN
PU_CLERK
PU_CLERK
PU_CLERK
PU_CLERK
PU_CLERK
ST_MAN
ST_MAN
ST_MAN
ST_MAN
ST_MAN
ST_CLERK
ST_CLERK
ST_CLERK
ST_CLERK
ST_CLERK
ST_CLERK
ST_CLERK
ST_CLERK
ST_CLERK
ST_CLERK
ST_CLERK
ST_CLERK
ST_CLERK
ST_CLERK
ST_CLERK
ST_CLERK
ST_CLERK
ST_CLERK
ST_CLERK
ST_CLERK
SA_MAN
SA_MAN
SA_MAN
SA_MAN
SA_MAN
SA_REP
SA_REP
SA_REP
SA_REP
SA_REP
SA_REP
SA_REP
SA_REP
SA_REP
SA_REP
SA_REP
SA_REP
SA_REP
SA_REP
SA_REP
SA_REP
SA_REP
SA_REP
SA_REP
SA_REP
SA_REP
SA_REP
07-MAR-98
07-DEC-99
07-DEC-94
18-MAY-95
24-DEC-97
24-JUL-97
15-NOV-98
10-AUG-99
18-JUL-96
10-APR-97
01-MAY-95
10-OCT-97
16-NOV-99
16-JUL-97
28-SEP-98
14-JAN-99
08-MAR-00
20-AUG-97
30-OCT-97
16-FEB-97
10-APR-99
14-JUN-96
26-AUG-98
12-DEC-99
06-FEB-00
14-JUL-95
26-OCT-97
12-FEB-98
06-APR-98
17-OCT-95
29-JAN-97
15-MAR-98
09-JUL-98
01-OCT-96
05-JAN-97
10-MAR-97
15-OCT-99
29-JAN-00
30-JAN-97
24-MAR-97
20-AUG-97
30-MAR-98
09-DEC-98
23-NOV-99
30-JAN-96
04-MAR-96
01-AUG-96
10-MAR-97
15-DEC-97
03-NOV-98
11-NOV-97
19-MAR-99
24-JAN-00
23-FEB-00
24-MAR-00
21-APR-00
11-MAR-97
23-MAR-98
24-JAN-98
23-FEB-99
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
Bates
Kumar
Abel
Hutton
Taylor
Livingston
Grant
Johnson
Taylor
Fleaur
Sullivan
Geoni
Sarchand
Bull
Dellinger
Cabrio
Chung
Dilly
Gates
Perkins
Bell
Everett
McCain
Jones
Walsh
Feeney
OConnell
Grant
Whalen
Hartstein
Fay
Mavris
Baer
Higgins
Gietz
SA_REP
SA_REP
SA_REP
SA_REP
SA_REP
SA_REP
SA_REP
SA_REP
SH_CLERK
SH_CLERK
SH_CLERK
SH_CLERK
SH_CLERK
SH_CLERK
SH_CLERK
SH_CLERK
SH_CLERK
SH_CLERK
SH_CLERK
SH_CLERK
SH_CLERK
SH_CLERK
SH_CLERK
SH_CLERK
SH_CLERK
SH_CLERK
SH_CLERK
SH_CLERK
AD_ASST
MK_MAN
MK_REP
HR_REP
PR_REP
AC_MGR
AC_ACCOUNT
24-MAR-99
21-APR-00
11-MAY-96
19-MAR-97
24-MAR-98
23-APR-98
24-MAY-99
04-JAN-00
24-JAN-98
23-FEB-98
21-JUN-99
03-FEB-00
27-JAN-96
20-FEB-97
24-JUN-98
07-FEB-99
14-JUN-97
13-AUG-97
11-JUL-98
19-DEC-99
04-FEB-96
03-MAR-97
01-JUL-98
17-MAR-99
24-APR-98
23-MAY-98
21-JUN-99
13-JAN-00
17-SEP-87
17-FEB-96
17-AUG-97
07-JUN-94
07-JUN-94
07-JUN-94
07-JUN-94
EMAIL
--------------------SKING
NKOCHHAR
LDEHAAN
AHUNOLD
NGREENBE
DFAVIET
JCHEN
DRAPHEAL
515.127.4561
121 Adam
650.123.2234
145 John
011.44.1344.429268
146 Karen
011.44.1344.467268
147 Alberto
011.44.1344.429278
148 Gerald
011.44.1344.619268
149 Eleni
011.44.1344.429018
150 Peter
011.44.1344.129268
151 David
011.44.1344.345268
152 Peter
011.44.1344.478968
156 Janette
011.44.1345.429268
157 Patrick
011.44.1345.929268
158 Allan
011.44.1345.829268
162 Clara
011.44.1346.129268
163 Danielle
011.44.1346.229268
168 Lisa
011.44.1343.929268
169 Harrison
011.44.1343.829268
170 Tayler
011.44.1343.729268
174 Ellen
011.44.1644.429267
175 Alyssa
011.44.1644.429266
176 Jonathon
011.44.1644.429265
177 Jack
011.44.1644.429264
201 Michael
515.123.5555
204 Hermann
515.123.8888
205 Shelley
515.123.8080
206 William
515.123.8181
33 rows selected.
SQL>
07-DEC-94 PU_MAN
Fripp
10-APR-97 ST_MAN
Russell
01-OCT-96 SA_MAN
Partners
05-JAN-97 SA_MAN
Errazuriz
10-MAR-97 SA_MAN
Cambrault
15-OCT-99 SA_MAN
Zlotkey
29-JAN-00 SA_MAN
Tucker
30-JAN-97 SA_REP
Bernstein
24-MAR-97 SA_REP
Hall
20-AUG-97 SA_REP
King
30-JAN-96 SA_REP
Sully
04-MAR-96 SA_REP
McEwen
01-AUG-96 SA_REP
Vishney
11-NOV-97 SA_REP
Greene
19-MAR-99 SA_REP
Ozer
11-MAR-97 SA_REP
Bloom
23-MAR-98 SA_REP
Fox
24-JAN-98 SA_REP
Abel
11-MAY-96 SA_REP
Hutton
19-MAR-97 SA_REP
Taylor
24-MAR-98 SA_REP
Livingston
23-APR-98 SA_REP
Hartstein
17-FEB-96 MK_MAN
Baer
07-JUN-94 PR_REP
Higgins
07-JUN-94 AC_MGR
Gietz
07-JUN-94 AC_ACCOUN
AFRIPP
JRUSSEL
KPARTNER
AERRAZUR
GCAMBRAU
EZLOTKEY
PTUCKER
DBERNSTE
PHALL
JKING
PSULLY
AMCEWEN
CVISHNEY
DGREENE
LOZER
HBLOOM
TFOX
EABEL
AHUTTON
JTAYLOR
JLIVINGS
MHARTSTE
HBAER
SHIGGINS
WGIETZ
Davies
Matos
Vargas
Taylor
Fleaur
Sullivan
Geoni
Sarchand
Bull
Dellinger
Cabrio
Chung
Dilly
Gates
Perkins
Bell
Everett
McCain
Jones
Walsh
Feeney
OConnell
Grant
Whalen
Hartstein
Fay
Mavris
Baer
Higgins
Gietz
72 rows selected.
SQL> -aliases
SP2-0042: unknown command "-aliases" - rest of line ignored.
SQL>
SQL> --aliases
SQL> select last_name,salary,commission_pct commission from employees where comm
ission is not null;
select last_name,salary,commission_pct commission from employees where commissio
n is not null
*
ERROR at line 1:
ORA-00904: "COMMISSION": invalid identifier
SQL> ed
Wrote file afiedt.buf
1* select last_name,salary,commission_pct as commission from employees where c
ommission is not nul
SQL> /
select last_name,salary,commission_pct as commission from employees where commis
sion is not null
*
ERROR at line 1:
ORA-00904: "COMMISSION": invalid identifier
SQL> ed
*
ERROR at line 1:
ORA-00904: "COMMISSION": invalid identifier
SQL> ed
Wrote file afiedt.buf
1* select last_name name,salary Salary,commission_pct comm from employees wher
e commission_pct is
SQL> /
NAME
SALARY
COMM
------------------------- ---------- ---------Russell
14000
.4
Partners
13500
.3
Errazuriz
12000
.3
Cambrault
11000
.3
Zlotkey
10500
.2
Tucker
10000
.3
Bernstein
9500
.25
Hall
9000
.25
Olsen
8000
.2
Cambrault
7500
.2
Tuvault
7000
.15
King
10000
.35
Sully
9500
.35
McEwen
9000
.35
Smith
8000
.3
Doran
7500
.3
Sewall
7000
.25
Vishney
10500
.25
Greene
9500
.15
Marvins
7200
.1
Lee
6800
.1
Ande
6400
.1
Banda
6200
.1
Ozer
11500
.25
Bloom
10000
.2
Fox
9600
.2
Smith
7400
.15
Bates
7300
.15
Kumar
6100
.1
Abel
11000
.3
Hutton
8800
.25
Taylor
8600
.2
Livingston
8400
.2
Grant
7000
.15
Johnson
6200
.1
35 rows selected.
SQL> ed
Wrote file afiedt.buf
1* select last_name name,salary Salary,commission_pct comm from employees wher
e commission_pct is
SQL> select last_name,salary*12 "annual salary" from employees
2 ;
LAST_NAME
annual salary
------------------------- ------------King
288000
Kochhar
204000
De Haan
204000
Hunold
108000
Ernst
72000
Austin
57600
Pataballa
57600
Lorentz
50400
Greenberg
144000
Faviet
108000
Chen
98400
Sciarra
92400
Urman
93600
Popp
82800
Raphaely
132000
Khoo
37200
Baida
34800
Tobias
33600
Himuro
31200
Colmenares
30000
Weiss
96000
Fripp
98400
Kaufling
94800
Vollman
78000
Mourgos
69600
Nayer
38400
Mikkilineni
32400
Landry
28800
Markle
26400
Bissot
39600
Atkinson
33600
Marlow
30000
Olson
25200
Mallin
39600
Rogers
34800
Gee
28800
Philtanker
26400
Ladwig
43200
Stiles
38400
Seo
32400
Patel
30000
Rajs
42000
Davies
37200
Matos
31200
Vargas
30000
Russell
168000
Partners
162000
Errazuriz
144000
Cambrault
132000
Zlotkey
126000
Tucker
120000
Bernstein
114000
Hall
108000
Olsen
96000
Cambrault
90000
Tuvault
84000
King
120000
Sully
114000
McEwen
Smith
Doran
Sewall
Vishney
Greene
Marvins
Lee
Ande
Banda
Ozer
Bloom
Fox
Smith
Bates
Kumar
Abel
Hutton
Taylor
Livingston
Grant
Johnson
Taylor
Fleaur
Sullivan
Geoni
Sarchand
Bull
Dellinger
Cabrio
Chung
Dilly
Gates
Perkins
Bell
Everett
McCain
Jones
Walsh
Feeney
OConnell
Grant
Whalen
Hartstein
Fay
Mavris
Baer
Higgins
Gietz
108000
96000
90000
84000
126000
114000
86400
81600
76800
74400
138000
120000
115200
88800
87600
73200
132000
105600
103200
100800
84000
74400
38400
37200
30000
33600
50400
49200
40800
36000
45600
43200
34800
30000
48000
46800
38400
33600
37200
36000
31200
31200
52800
156000
72000
78000
120000
144000
99600
AlexanderHunold
BruceErnst
DavidAustin
ValliPataballa
DianaLorentz
NancyGreenberg
DanielFaviet
JohnChen
IsmaelSciarra
Jose ManuelUrman
LuisPopp
DenRaphaely
AlexanderKhoo
ShelliBaida
SigalTobias
GuyHimuro
KarenColmenares
MatthewWeiss
AdamFripp
PayamKaufling
ShantaVollman
KevinMourgos
JuliaNayer
IreneMikkilineni
JamesLandry
StevenMarkle
LauraBissot
MozheAtkinson
JamesMarlow
TJOlson
JasonMallin
MichaelRogers
KiGee
HazelPhiltanker
RenskeLadwig
StephenStiles
JohnSeo
JoshuaPatel
TrennaRajs
CurtisDavies
RandallMatos
PeterVargas
JohnRussell
KarenPartners
AlbertoErrazuriz
GeraldCambrault
EleniZlotkey
PeterTucker
DavidBernstein
PeterHall
ChristopherOlsen
NanetteCambrault
OliverTuvault
JanetteKing
PatrickSully
AllanMcEwen
LindseySmith
LouiseDoran
SarathSewall
ClaraVishney
DanielleGreene
MatteaMarvins
DavidLee
SundarAnde
AmitBanda
LisaOzer
HarrisonBloom
TaylerFox
WilliamSmith
ElizabethBates
SunditaKumar
EllenAbel
AlyssaHutton
JonathonTaylor
JackLivingston
KimberelyGrant
CharlesJohnson
WinstonTaylor
JeanFleaur
MarthaSullivan
GirardGeoni
NanditaSarchand
AlexisBull
JuliaDellinger
AnthonyCabrio
KellyChung
JenniferDilly
TimothyGates
RandallPerkins
SarahBell
BritneyEverett
SamuelMcCain
VanceJones
AlanaWalsh
KevinFeeney
DonaldOConnell
DouglasGrant
JenniferWhalen
MichaelHartstein
PatFay
SusanMavris
HermannBaer
ShelleyHiggins
WilliamGietz
107 rows selected.
SQL> --literal strings
SQL> select first_name||' '||last_name from employees;
FIRST_NAME||''||LAST_NAME
---------------------------------------------Steven King
Neena Kochhar
Lex De Haan
Alexander Hunold
Bruce Ernst
David Austin
Valli Pataballa
Diana Lorentz
Nancy Greenberg
Daniel Faviet
John Chen
Ismael Sciarra
Jose Manuel Urman
Luis Popp
Den Raphaely
Alexander Khoo
Shelli Baida
Sigal Tobias
Guy Himuro
Karen Colmenares
Matthew Weiss
Adam Fripp
Payam Kaufling
Shanta Vollman
Kevin Mourgos
Julia Nayer
Irene Mikkilineni
James Landry
Steven Markle
Laura Bissot
Mozhe Atkinson
James Marlow
TJ Olson
Jason Mallin
Michael Rogers
Ki Gee
Hazel Philtanker
Renske Ladwig
Stephen Stiles
John Seo
Joshua Patel
Trenna Rajs
Curtis Davies
Randall Matos
Peter Vargas
John Russell
Karen Partners
Alberto Errazuriz
Gerald Cambrault
Eleni Zlotkey
Peter Tucker
David Bernstein
Peter Hall
Christopher Olsen
Nanette Cambrault
Oliver Tuvault
Janette King
Patrick Sully
Allan McEwen
Lindsey Smith
Louise Doran
Sarath Sewall
Clara Vishney
Danielle Greene
Mattea Marvins
David Lee
Sundar Ande
Amit Banda
Lisa Ozer
Harrison Bloom
Tayler Fox
William Smith
Elizabeth Bates
Sundita Kumar
Ellen Abel
Alyssa Hutton
Jonathon Taylor
Jack Livingston
Kimberely Grant
Charles Johnson
Winston Taylor
Jean Fleaur
Martha Sullivan
Girard Geoni
Nandita Sarchand
Alexis Bull
Julia Dellinger
Anthony Cabrio
Kelly Chung
Jennifer Dilly
Timothy Gates
Randall Perkins
Sarah Bell
Britney Everett
Samuel McCain
Vance Jones
Alana Walsh
Kevin Feeney
Donald OConnell
Douglas Grant
Jennifer Whalen
Michael Hartstein
Pat Fay
Susan Mavris
Hermann Baer
Shelley Higgins
William Gietz
107 rows selected.
SQL> --eliminating duplicate rows
SQL> select distinct department_id from employees;
DEPARTMENT_ID
------------10
20
30
40
50
60
70
80
90
100
110
12 rows selected.
SQL> --describing structures of table
SQL> desc employees;
Name
Null?
T
-------------------------------------------------------------------------------------------------EMPLOYEE_ID
NOT NULL N
FIRST_NAME
V
LAST_NAME
NOT NULL V
EMAIL
NOT NULL V
PHONE_NUMBER
V
HIRE_DATE
NOT NULL D
JOB_ID
NOT NULL V
SALARY
N
COMMISSION_PCT
N
MANAGER_ID
N
DEPARTMENT_ID
N
SQL> SELECT employee_id, last_name
2 sal x 12 ANNUAL SALARY
3 FROM employees;
sal x 12 ANNUAL SALARY
*
ERROR at line 2:
ORA-00923: FROM keyword not found where expected
SQL> ed
Wrote file afiedt.buf
1 SELECT employee_id, last_name
2 sal * 12 ANNUAL SALARY
3* FROM employees
SQL> /
sal * 12 ANNUAL SALARY
*
ERROR at line 2:
ORA-00923: FROM keyword not found where expected
SQL> ed
Wrote file afiedt.buf
1
2
3*
SQL>
EMPLOYEE_ID
----------100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
LAST_NAME
ANNUAL SALARY
------------------------- ------------King
288000
Kochhar
204000
De Haan
204000
Hunold
108000
Ernst
72000
Austin
57600
Pataballa
57600
Lorentz
50400
Greenberg
144000
Faviet
108000
Chen
98400
Sciarra
92400
Urman
93600
Popp
82800
Raphaely
132000
Khoo
37200
Baida
34800
Tobias
33600
Himuro
31200
Colmenares
30000
Weiss
96000
Fripp
98400
Kaufling
94800
Vollman
78000
Mourgos
69600
Nayer
38400
Mikkilineni
32400
Landry
28800
Markle
26400
Bissot
39600
Atkinson
33600
Marlow
30000
Olson
25200
Mallin
39600
Rogers
34800
Gee
28800
Philtanker
26400
Ladwig
43200
Stiles
38400
Seo
32400
Patel
30000
Rajs
42000
Davies
37200
Matos
31200
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
Vargas
Russell
Partners
Errazuriz
Cambrault
Zlotkey
Tucker
Bernstein
Hall
Olsen
Cambrault
Tuvault
King
Sully
McEwen
Smith
Doran
Sewall
Vishney
Greene
Marvins
Lee
Ande
Banda
Ozer
Bloom
Fox
Smith
Bates
Kumar
Abel
Hutton
Taylor
Livingston
Grant
Johnson
Taylor
Fleaur
Sullivan
Geoni
Sarchand
Bull
Dellinger
Cabrio
Chung
Dilly
Gates
Perkins
Bell
Everett
McCain
Jones
Walsh
Feeney
OConnell
Grant
Whalen
Hartstein
Fay
Mavris
30000
168000
162000
144000
132000
126000
120000
114000
108000
96000
90000
84000
120000
114000
108000
96000
90000
84000
126000
114000
86400
81600
76800
74400
138000
120000
115200
88800
87600
73200
132000
105600
103200
100800
84000
74400
38400
37200
30000
33600
50400
49200
40800
36000
45600
43200
34800
30000
48000
46800
38400
33600
37200
36000
31200
31200
52800
156000
72000
78000
204 Baer
205 Higgins
206 Gietz
120000
144000
99600
DEPARTMENT_NAME
MANAGER_ID LOCATION_ID
------------------------------ ---------- ----------Administration
200
1700
Marketing
201
1800
Purchasing
114
1700
Human Resources
203
2400
Shipping
121
1500
IT
103
1400
Public Relations
204
2700
Sales
145
2500
Executive
100
1700
Finance
108
1700
Accounting
205
1700
Treasury
1700
Corporate Tax
1700
Control And Credit
1700
Shareholder Services
1700
Benefits
1700
Manufacturing
1700
Construction
1700
Contracting
1700
Operations
1700
IT Support
1700
NOC
1700
IT Helpdesk
1700
Government Sales
1700
Retail Sales
1700
Recruiting
1700
Payroll
1700
27 rows selected.
SQL> --7:
SQL> desc employees;
Name
Null?
-------------------------------------------------------------------------------------------------EMPLOYEE_ID
NOT NULL N
FIRST_NAME
V
LAST_NAME
NOT NULL V
EMAIL
NOT NULL V
PHONE_NUMBER
V
HIRE_DATE
NOT NULL D
JOB_ID
NOT NULL V
SALARY
N
COMMISSION_PCT
N
MANAGER_ID
N
DEPARTMENT_ID
N
SQL> select last_name Name,job_code,hire_date "Start Date",employee_id from empl
oyees;
select last_name Name,job_code,hire_date "Start Date",employee_id from employees
*
ERROR at line 1:
ORA-00904: "JOB_CODE": invalid identifier
SQL> ed
Wrote file afiedt.buf
1* select employee_id,last_name Name,job_id,hire_date "Start Date" from employ
ees
SQL> /
EMPLOYEE_ID
----------100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
NAME
------------------------King
Kochhar
De Haan
Hunold
Ernst
Austin
Pataballa
Lorentz
Greenberg
Faviet
Chen
Sciarra
Urman
Popp
Raphaely
Khoo
Baida
Tobias
JOB_ID
---------AD_PRES
AD_VP
AD_VP
IT_PROG
IT_PROG
IT_PROG
IT_PROG
IT_PROG
FI_MGR
FI_ACCOUNT
FI_ACCOUNT
FI_ACCOUNT
FI_ACCOUNT
FI_ACCOUNT
PU_MAN
PU_CLERK
PU_CLERK
PU_CLERK
Start Dat
--------17-JUN-87
21-SEP-89
13-JAN-93
03-JAN-90
21-MAY-91
25-JUN-97
05-FEB-98
07-FEB-99
17-AUG-94
16-AUG-94
28-SEP-97
30-SEP-97
07-MAR-98
07-DEC-99
07-DEC-94
18-MAY-95
24-DEC-97
24-JUL-97
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
Himuro
Colmenares
Weiss
Fripp
Kaufling
Vollman
Mourgos
Nayer
Mikkilineni
Landry
Markle
Bissot
Atkinson
Marlow
Olson
Mallin
Rogers
Gee
Philtanker
Ladwig
Stiles
Seo
Patel
Rajs
Davies
Matos
Vargas
Russell
Partners
Errazuriz
Cambrault
Zlotkey
Tucker
Bernstein
Hall
Olsen
Cambrault
Tuvault
King
Sully
McEwen
Smith
Doran
Sewall
Vishney
Greene
Marvins
Lee
Ande
Banda
Ozer
Bloom
Fox
Smith
Bates
Kumar
Abel
Hutton
Taylor
Livingston
PU_CLERK
PU_CLERK
ST_MAN
ST_MAN
ST_MAN
ST_MAN
ST_MAN
ST_CLERK
ST_CLERK
ST_CLERK
ST_CLERK
ST_CLERK
ST_CLERK
ST_CLERK
ST_CLERK
ST_CLERK
ST_CLERK
ST_CLERK
ST_CLERK
ST_CLERK
ST_CLERK
ST_CLERK
ST_CLERK
ST_CLERK
ST_CLERK
ST_CLERK
ST_CLERK
SA_MAN
SA_MAN
SA_MAN
SA_MAN
SA_MAN
SA_REP
SA_REP
SA_REP
SA_REP
SA_REP
SA_REP
SA_REP
SA_REP
SA_REP
SA_REP
SA_REP
SA_REP
SA_REP
SA_REP
SA_REP
SA_REP
SA_REP
SA_REP
SA_REP
SA_REP
SA_REP
SA_REP
SA_REP
SA_REP
SA_REP
SA_REP
SA_REP
SA_REP
15-NOV-98
10-AUG-99
18-JUL-96
10-APR-97
01-MAY-95
10-OCT-97
16-NOV-99
16-JUL-97
28-SEP-98
14-JAN-99
08-MAR-00
20-AUG-97
30-OCT-97
16-FEB-97
10-APR-99
14-JUN-96
26-AUG-98
12-DEC-99
06-FEB-00
14-JUL-95
26-OCT-97
12-FEB-98
06-APR-98
17-OCT-95
29-JAN-97
15-MAR-98
09-JUL-98
01-OCT-96
05-JAN-97
10-MAR-97
15-OCT-99
29-JAN-00
30-JAN-97
24-MAR-97
20-AUG-97
30-MAR-98
09-DEC-98
23-NOV-99
30-JAN-96
04-MAR-96
01-AUG-96
10-MAR-97
15-DEC-97
03-NOV-98
11-NOV-97
19-MAR-99
24-JAN-00
23-FEB-00
24-MAR-00
21-APR-00
11-MAR-97
23-MAR-98
24-JAN-98
23-FEB-99
24-MAR-99
21-APR-00
11-MAY-96
19-MAR-97
24-MAR-98
23-APR-98
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
Grant
Johnson
Taylor
Fleaur
Sullivan
Geoni
Sarchand
Bull
Dellinger
Cabrio
Chung
Dilly
Gates
Perkins
Bell
Everett
McCain
Jones
Walsh
Feeney
OConnell
Grant
Whalen
Hartstein
Fay
Mavris
Baer
Higgins
Gietz
SA_REP
SA_REP
SH_CLERK
SH_CLERK
SH_CLERK
SH_CLERK
SH_CLERK
SH_CLERK
SH_CLERK
SH_CLERK
SH_CLERK
SH_CLERK
SH_CLERK
SH_CLERK
SH_CLERK
SH_CLERK
SH_CLERK
SH_CLERK
SH_CLERK
SH_CLERK
SH_CLERK
SH_CLERK
AD_ASST
MK_MAN
MK_REP
HR_REP
PR_REP
AC_MGR
AC_ACCOUNT
24-MAY-99
04-JAN-00
24-JAN-98
23-FEB-98
21-JUN-99
03-FEB-00
27-JAN-96
20-FEB-97
24-JUN-98
07-FEB-99
14-JUN-97
13-AUG-97
11-JUL-98
19-DEC-99
04-FEB-96
03-MAR-97
01-JUL-98
17-MAR-99
24-APR-98
23-MAY-98
21-JUN-99
13-JAN-00
17-SEP-87
17-FEB-96
17-AUG-97
07-JUN-94
07-JUN-94
07-JUN-94
07-JUN-94
EMAIL
--------------------SKING
NKOCHHAR
LDEHAAN
AHUNOLD
NGREENBE
DFAVIET
JCHEN
DRAPHEAL
AFRIPP
JRUSSEL
KPARTNER
011.44.1344.467268
147 Alberto
011.44.1344.429278
148 Gerald
011.44.1344.619268
149 Eleni
011.44.1344.429018
150 Peter
011.44.1344.129268
151 David
011.44.1344.345268
152 Peter
011.44.1344.478968
156 Janette
011.44.1345.429268
157 Patrick
011.44.1345.929268
158 Allan
011.44.1345.829268
162 Clara
011.44.1346.129268
163 Danielle
011.44.1346.229268
168 Lisa
011.44.1343.929268
169 Harrison
011.44.1343.829268
170 Tayler
011.44.1343.729268
174 Ellen
011.44.1644.429267
175 Alyssa
011.44.1644.429266
176 Jonathon
011.44.1644.429265
177 Jack
011.44.1644.429264
201 Michael
515.123.5555
204 Hermann
515.123.8888
205 Shelley
515.123.8080
206 William
515.123.8181
05-JAN-97 SA_MAN
Errazuriz
10-MAR-97 SA_MAN
Cambrault
15-OCT-99 SA_MAN
Zlotkey
29-JAN-00 SA_MAN
Tucker
30-JAN-97 SA_REP
Bernstein
24-MAR-97 SA_REP
Hall
20-AUG-97 SA_REP
King
30-JAN-96 SA_REP
Sully
04-MAR-96 SA_REP
McEwen
01-AUG-96 SA_REP
Vishney
11-NOV-97 SA_REP
Greene
19-MAR-99 SA_REP
Ozer
11-MAR-97 SA_REP
Bloom
23-MAR-98 SA_REP
Fox
24-JAN-98 SA_REP
Abel
11-MAY-96 SA_REP
Hutton
19-MAR-97 SA_REP
Taylor
24-MAR-98 SA_REP
Livingston
23-APR-98 SA_REP
Hartstein
17-FEB-96 MK_MAN
Baer
07-JUN-94 PR_REP
Higgins
07-JUN-94 AC_MGR
Gietz
07-JUN-94 AC_ACCOUN
33 rows selected.
SQL>
AERRAZUR
GCAMBRAU
EZLOTKEY
PTUCKER
DBERNSTE
PHALL
JKING
PSULLY
AMCEWEN
CVISHNEY
DGREENE
LOZER
HBLOOM
TFOX
EABEL
AHUTTON
JTAYLOR
JLIVINGS
MHARTSTE
HBAER
SHIGGINS
WGIETZ
Geoni
Sarchand
Bull
Dellinger
Cabrio
Chung
Dilly
Gates
Perkins
Bell
Everett
McCain
Jones
Walsh
Feeney
OConnell
Grant
Whalen
Hartstein
Fay
Mavris
Baer
Higgins
Gietz
72 rows selected.
SQL> -aliases
SP2-0042: unknown command "-aliases" - rest of line ignored.
SQL>
SQL> --aliases
SQL> select last_name,salary,commission_pct commission from employees where comm
ission is not null;
select last_name,salary,commission_pct commission from employees where commissio
n is not null
*
ERROR at line 1:
ORA-00904: "COMMISSION": invalid identifier
SQL> ed
Wrote file afiedt.buf
1* select last_name,salary,commission_pct as commission from employees where c
ommission is not nul
SQL> /
select last_name,salary,commission_pct as commission from employees where commis
sion is not null
*
ERROR at line 1:
ORA-00904: "COMMISSION": invalid identifier
SQL> ed
Wrote file afiedt.buf
1* select last_name,salary,commission_pct "commission" from employees where co
mmission is not null
SQL> /
select last_name,salary,commission_pct "commission" from employees where commiss
Ernst
Austin
Pataballa
Lorentz
Greenberg
Faviet
Chen
Sciarra
Urman
Popp
Raphaely
Khoo
Baida
Tobias
Himuro
Colmenares
Weiss
Fripp
Kaufling
Vollman
Mourgos
Nayer
Mikkilineni
Landry
Markle
Bissot
Atkinson
Marlow
Olson
Mallin
Rogers
Gee
Philtanker
Ladwig
Stiles
Seo
Patel
Rajs
Davies
Matos
Vargas
Russell
Partners
Errazuriz
Cambrault
Zlotkey
Tucker
Bernstein
Hall
Olsen
Cambrault
Tuvault
King
Sully
McEwen
Smith
Doran
Sewall
Vishney
Greene
72000
57600
57600
50400
144000
108000
98400
92400
93600
82800
132000
37200
34800
33600
31200
30000
96000
98400
94800
78000
69600
38400
32400
28800
26400
39600
33600
30000
25200
39600
34800
28800
26400
43200
38400
32400
30000
42000
37200
31200
30000
168000
162000
144000
132000
126000
120000
114000
108000
96000
90000
84000
120000
114000
108000
96000
90000
84000
126000
114000
Marvins
Lee
Ande
Banda
Ozer
Bloom
Fox
Smith
Bates
Kumar
Abel
Hutton
Taylor
Livingston
Grant
Johnson
Taylor
Fleaur
Sullivan
Geoni
Sarchand
Bull
Dellinger
Cabrio
Chung
Dilly
Gates
Perkins
Bell
Everett
McCain
Jones
Walsh
Feeney
OConnell
Grant
Whalen
Hartstein
Fay
Mavris
Baer
Higgins
Gietz
86400
81600
76800
74400
138000
120000
115200
88800
87600
73200
132000
105600
103200
100800
84000
74400
38400
37200
30000
33600
50400
49200
40800
36000
45600
43200
34800
30000
48000
46800
38400
33600
37200
36000
31200
31200
52800
156000
72000
78000
120000
144000
99600
DanielFaviet
JohnChen
IsmaelSciarra
Jose ManuelUrman
LuisPopp
DenRaphaely
AlexanderKhoo
ShelliBaida
SigalTobias
GuyHimuro
KarenColmenares
MatthewWeiss
AdamFripp
PayamKaufling
ShantaVollman
KevinMourgos
JuliaNayer
IreneMikkilineni
JamesLandry
StevenMarkle
LauraBissot
MozheAtkinson
JamesMarlow
TJOlson
JasonMallin
MichaelRogers
KiGee
HazelPhiltanker
RenskeLadwig
StephenStiles
JohnSeo
JoshuaPatel
TrennaRajs
CurtisDavies
RandallMatos
PeterVargas
JohnRussell
KarenPartners
AlbertoErrazuriz
GeraldCambrault
EleniZlotkey
PeterTucker
DavidBernstein
PeterHall
ChristopherOlsen
NanetteCambrault
OliverTuvault
JanetteKing
PatrickSully
AllanMcEwen
LindseySmith
LouiseDoran
SarathSewall
ClaraVishney
DanielleGreene
MatteaMarvins
DavidLee
SundarAnde
AmitBanda
LisaOzer
HarrisonBloom
TaylerFox
WilliamSmith
ElizabethBates
SunditaKumar
EllenAbel
AlyssaHutton
JonathonTaylor
JackLivingston
KimberelyGrant
CharlesJohnson
WinstonTaylor
JeanFleaur
MarthaSullivan
GirardGeoni
NanditaSarchand
AlexisBull
JuliaDellinger
AnthonyCabrio
KellyChung
JenniferDilly
TimothyGates
RandallPerkins
SarahBell
BritneyEverett
SamuelMcCain
VanceJones
AlanaWalsh
KevinFeeney
DonaldOConnell
DouglasGrant
JenniferWhalen
MichaelHartstein
PatFay
SusanMavris
HermannBaer
ShelleyHiggins
WilliamGietz
107 rows selected.
SQL> --literal strings
SQL> select first_name||' '||last_name from employees;
FIRST_NAME||''||LAST_NAME
---------------------------------------------Steven King
Neena Kochhar
Lex De Haan
Alexander Hunold
Bruce Ernst
David Austin
Valli Pataballa
Diana Lorentz
Nancy Greenberg
Daniel Faviet
John Chen
Ismael Sciarra
Jose Manuel Urman
Luis Popp
Den Raphaely
Alexander Khoo
Shelli Baida
Sigal Tobias
Guy Himuro
Karen Colmenares
Matthew Weiss
Adam Fripp
Payam Kaufling
Shanta Vollman
Kevin Mourgos
Julia Nayer
Irene Mikkilineni
James Landry
Steven Markle
Laura Bissot
Mozhe Atkinson
James Marlow
TJ Olson
Jason Mallin
Michael Rogers
Ki Gee
Hazel Philtanker
Renske Ladwig
Stephen Stiles
John Seo
Joshua Patel
Trenna Rajs
Curtis Davies
Randall Matos
Peter Vargas
John Russell
Karen Partners
Alberto Errazuriz
Gerald Cambrault
Eleni Zlotkey
Peter Tucker
David Bernstein
Peter Hall
Christopher Olsen
Nanette Cambrault
Oliver Tuvault
Janette King
Patrick Sully
Allan McEwen
Lindsey Smith
Louise Doran
Sarath Sewall
Clara Vishney
Danielle Greene
Mattea Marvins
David Lee
Sundar Ande
Amit Banda
Lisa Ozer
Harrison Bloom
Tayler Fox
William Smith
Elizabeth Bates
Sundita Kumar
Ellen Abel
Alyssa Hutton
Jonathon Taylor
Jack Livingston
Kimberely Grant
Charles Johnson
Winston Taylor
Jean Fleaur
Martha Sullivan
Girard Geoni
Nandita Sarchand
Alexis Bull
Julia Dellinger
Anthony Cabrio
Kelly Chung
Jennifer Dilly
Timothy Gates
Randall Perkins
Sarah Bell
Britney Everett
Samuel McCain
Vance Jones
Alana Walsh
Kevin Feeney
Donald OConnell
Douglas Grant
Jennifer Whalen
Michael Hartstein
Pat Fay
Susan Mavris
Hermann Baer
Shelley Higgins
William Gietz
107 rows selected.
SQL> --eliminating duplicate rows
SQL> select distinct department_id from employees;
DEPARTMENT_ID
------------10
20
30
40
50
60
70
80
90
100
110
12 rows selected.
SQL> --describing structures of table
SQL> desc employees;
Name
Null?
-------------------------------------------------------------------------------------------------EMPLOYEE_ID
NOT NULL N
FIRST_NAME
V
LAST_NAME
NOT NULL V
EMAIL
NOT NULL V
PHONE_NUMBER
V
HIRE_DATE
NOT NULL D
JOB_ID
NOT NULL V
SALARY
N
COMMISSION_PCT
N
MANAGER_ID
N
DEPARTMENT_ID
N
SQL> SELECT employee_id, last_name
2 sal x 12 ANNUAL SALARY
3 FROM employees;
sal x 12 ANNUAL SALARY
*
ERROR at line 2:
ORA-00923: FROM keyword not found where expected
SQL> ed
Wrote file afiedt.buf
1 SELECT employee_id, last_name
2 sal * 12 ANNUAL SALARY
3* FROM employees
SQL> /
sal * 12 ANNUAL SALARY
*
ERROR at line 2:
ORA-00923: FROM keyword not found where expected
SQL> ed
Wrote file afiedt.buf
1 SELECT employee_id, last_name,
2 sal * 12 ANNUAL SALARY
3* FROM employees
SQL> /
sal * 12 ANNUAL SALARY
*
ERROR at line 2:
ORA-00923: FROM keyword not found where expected
SQL> ed
Wrote file afiedt.buf
1
2
3*
SQL>
EMPLOYEE_ID
----------100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
LAST_NAME
ANNUAL SALARY
------------------------- ------------King
288000
Kochhar
204000
De Haan
204000
Hunold
108000
Ernst
72000
Austin
57600
Pataballa
57600
Lorentz
50400
Greenberg
144000
Faviet
108000
Chen
98400
Sciarra
92400
Urman
93600
Popp
82800
Raphaely
132000
Khoo
37200
Baida
34800
Tobias
33600
Himuro
31200
Colmenares
30000
Weiss
96000
Fripp
98400
Kaufling
94800
Vollman
78000
Mourgos
69600
Nayer
38400
Mikkilineni
32400
Landry
28800
Markle
26400
Bissot
39600
Atkinson
33600
Marlow
30000
Olson
25200
Mallin
39600
Rogers
34800
Gee
28800
Philtanker
26400
Ladwig
43200
Stiles
38400
Seo
32400
Patel
30000
Rajs
42000
Davies
37200
Matos
31200
Vargas
30000
Russell
168000
Partners
162000
Errazuriz
144000
Cambrault
132000
Zlotkey
126000
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
Tucker
Bernstein
Hall
Olsen
Cambrault
Tuvault
King
Sully
McEwen
Smith
Doran
Sewall
Vishney
Greene
Marvins
Lee
Ande
Banda
Ozer
Bloom
Fox
Smith
Bates
Kumar
Abel
Hutton
Taylor
Livingston
Grant
Johnson
Taylor
Fleaur
Sullivan
Geoni
Sarchand
Bull
Dellinger
Cabrio
Chung
Dilly
Gates
Perkins
Bell
Everett
McCain
Jones
Walsh
Feeney
OConnell
Grant
Whalen
Hartstein
Fay
Mavris
Baer
Higgins
Gietz
120000
114000
108000
96000
90000
84000
120000
114000
108000
96000
90000
84000
126000
114000
86400
81600
76800
74400
138000
120000
115200
88800
87600
73200
132000
105600
103200
100800
84000
74400
38400
37200
30000
33600
50400
49200
40800
36000
45600
43200
34800
30000
48000
46800
38400
33600
37200
36000
31200
31200
52800
156000
72000
78000
120000
144000
99600
SQL> --practice 1
SQL> --6:
SQL> desc departments;
Name
Null?
T
-------------------------------------------------------------------------------------------------DEPARTMENT_ID
NOT NULL N
DEPARTMENT_NAME
NOT NULL V
MANAGER_ID
N
LOCATION_ID
N
SQL> select * from departments;
DEPARTMENT_ID
------------10
20
30
40
50
60
70
80
90
100
110
120
130
140
150
160
170
180
190
200
210
220
230
240
250
260
270
DEPARTMENT_NAME
MANAGER_ID LOCATION_ID
------------------------------ ---------- ----------Administration
200
1700
Marketing
201
1800
Purchasing
114
1700
Human Resources
203
2400
Shipping
121
1500
IT
103
1400
Public Relations
204
2700
Sales
145
2500
Executive
100
1700
Finance
108
1700
Accounting
205
1700
Treasury
1700
Corporate Tax
1700
Control And Credit
1700
Shareholder Services
1700
Benefits
1700
Manufacturing
1700
Construction
1700
Contracting
1700
Operations
1700
IT Support
1700
NOC
1700
IT Helpdesk
1700
Government Sales
1700
Retail Sales
1700
Recruiting
1700
Payroll
1700
27 rows selected.
SQL> --7:
SQL> desc employees;
Name
Null?
T
-------------------------------------------------------------------------------------------------EMPLOYEE_ID
NOT NULL N
FIRST_NAME
V
LAST_NAME
NOT NULL V
EMAIL
NOT NULL V
PHONE_NUMBER
V
HIRE_DATE
NOT NULL D
JOB_ID
NOT NULL V
SALARY
N
COMMISSION_PCT
N
MANAGER_ID
N
DEPARTMENT_ID
N
SQL> select last_name Name,job_code,hire_date "Start Date",employee_id from empl
oyees;
select last_name Name,job_code,hire_date "Start Date",employee_id from employees
*
ERROR at line 1:
ORA-00904: "JOB_CODE": invalid identifier
SQL> ed
Wrote file afiedt.buf
1* select employee_id,last_name Name,job_id,hire_date "Start Date" from employ
ees
SQL> /
EMPLOYEE_ID
----------100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
NAME
------------------------King
Kochhar
De Haan
Hunold
Ernst
Austin
Pataballa
Lorentz
Greenberg
Faviet
Chen
Sciarra
Urman
Popp
Raphaely
Khoo
Baida
Tobias
Himuro
Colmenares
Weiss
Fripp
Kaufling
Vollman
JOB_ID
---------AD_PRES
AD_VP
AD_VP
IT_PROG
IT_PROG
IT_PROG
IT_PROG
IT_PROG
FI_MGR
FI_ACCOUNT
FI_ACCOUNT
FI_ACCOUNT
FI_ACCOUNT
FI_ACCOUNT
PU_MAN
PU_CLERK
PU_CLERK
PU_CLERK
PU_CLERK
PU_CLERK
ST_MAN
ST_MAN
ST_MAN
ST_MAN
Start Dat
--------17-JUN-87
21-SEP-89
13-JAN-93
03-JAN-90
21-MAY-91
25-JUN-97
05-FEB-98
07-FEB-99
17-AUG-94
16-AUG-94
28-SEP-97
30-SEP-97
07-MAR-98
07-DEC-99
07-DEC-94
18-MAY-95
24-DEC-97
24-JUL-97
15-NOV-98
10-AUG-99
18-JUL-96
10-APR-97
01-MAY-95
10-OCT-97
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
Mourgos
Nayer
Mikkilineni
Landry
Markle
Bissot
Atkinson
Marlow
Olson
Mallin
Rogers
Gee
Philtanker
Ladwig
Stiles
Seo
Patel
Rajs
Davies
Matos
Vargas
Russell
Partners
Errazuriz
Cambrault
Zlotkey
Tucker
Bernstein
Hall
Olsen
Cambrault
Tuvault
King
Sully
McEwen
Smith
Doran
Sewall
Vishney
Greene
Marvins
Lee
Ande
Banda
Ozer
Bloom
Fox
Smith
Bates
Kumar
Abel
Hutton
Taylor
Livingston
Grant
Johnson
Taylor
Fleaur
Sullivan
Geoni
ST_MAN
ST_CLERK
ST_CLERK
ST_CLERK
ST_CLERK
ST_CLERK
ST_CLERK
ST_CLERK
ST_CLERK
ST_CLERK
ST_CLERK
ST_CLERK
ST_CLERK
ST_CLERK
ST_CLERK
ST_CLERK
ST_CLERK
ST_CLERK
ST_CLERK
ST_CLERK
ST_CLERK
SA_MAN
SA_MAN
SA_MAN
SA_MAN
SA_MAN
SA_REP
SA_REP
SA_REP
SA_REP
SA_REP
SA_REP
SA_REP
SA_REP
SA_REP
SA_REP
SA_REP
SA_REP
SA_REP
SA_REP
SA_REP
SA_REP
SA_REP
SA_REP
SA_REP
SA_REP
SA_REP
SA_REP
SA_REP
SA_REP
SA_REP
SA_REP
SA_REP
SA_REP
SA_REP
SA_REP
SH_CLERK
SH_CLERK
SH_CLERK
SH_CLERK
16-NOV-99
16-JUL-97
28-SEP-98
14-JAN-99
08-MAR-00
20-AUG-97
30-OCT-97
16-FEB-97
10-APR-99
14-JUN-96
26-AUG-98
12-DEC-99
06-FEB-00
14-JUL-95
26-OCT-97
12-FEB-98
06-APR-98
17-OCT-95
29-JAN-97
15-MAR-98
09-JUL-98
01-OCT-96
05-JAN-97
10-MAR-97
15-OCT-99
29-JAN-00
30-JAN-97
24-MAR-97
20-AUG-97
30-MAR-98
09-DEC-98
23-NOV-99
30-JAN-96
04-MAR-96
01-AUG-96
10-MAR-97
15-DEC-97
03-NOV-98
11-NOV-97
19-MAR-99
24-JAN-00
23-FEB-00
24-MAR-00
21-APR-00
11-MAR-97
23-MAR-98
24-JAN-98
23-FEB-99
24-MAR-99
21-APR-00
11-MAY-96
19-MAR-97
24-MAR-98
23-APR-98
24-MAY-99
04-JAN-00
24-JAN-98
23-FEB-98
21-JUN-99
03-FEB-00
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
Sarchand
Bull
Dellinger
Cabrio
Chung
Dilly
Gates
Perkins
Bell
Everett
McCain
Jones
Walsh
Feeney
OConnell
Grant
Whalen
Hartstein
Fay
Mavris
Baer
Higgins
Gietz
SH_CLERK
SH_CLERK
SH_CLERK
SH_CLERK
SH_CLERK
SH_CLERK
SH_CLERK
SH_CLERK
SH_CLERK
SH_CLERK
SH_CLERK
SH_CLERK
SH_CLERK
SH_CLERK
SH_CLERK
SH_CLERK
AD_ASST
MK_MAN
MK_REP
HR_REP
PR_REP
AC_MGR
AC_ACCOUNT
27-JAN-96
20-FEB-97
24-JUN-98
07-FEB-99
14-JUN-97
13-AUG-97
11-JUL-98
19-DEC-99
04-FEB-96
03-MAR-97
01-JUL-98
17-MAR-99
24-APR-98
23-MAY-98
21-JUN-99
13-JAN-00
17-SEP-87
17-FEB-96
17-AUG-97
07-JUN-94
07-JUN-94
07-JUN-94
07-JUN-94
MK_MAN
MK_REP
PR_REP
PU_CLERK
PU_MAN
SA_MAN
SA_REP
SH_CLERK
ST_CLERK
ST_MAN
19 rows selected.
SQL> select employee_id EMP#,last_name Employee,job_id Job,hire_date from employ
ees
2 ;
EMP# EMPLOYEE
JOB
HIRE_DATE
AD_PRES
17-JUN-87
101 Kochhar
AD_VP
21-SEP-89
102 De Haan
AD_VP
13-JAN-93
103 Hunold
IT_PROG
03-JAN-90
104 Ernst
IT_PROG
21-MAY-91
105 Austin
IT_PROG
25-JUN-97
106 Pataballa
IT_PROG
05-FEB-98
107 Lorentz
IT_PROG
07-FEB-99
108 Greenberg
FI_MGR
17-AUG-94
109 Faviet
FI_ACCOUNT 16-AUG-94
110 Chen
FI_ACCOUNT 28-SEP-97
111 Sciarra
FI_ACCOUNT 30-SEP-97
112 Urman
FI_ACCOUNT 07-MAR-98
113 Popp
FI_ACCOUNT 07-DEC-99
114 Raphaely
PU_MAN
07-DEC-94
115 Khoo
PU_CLERK
18-MAY-95
116 Baida
PU_CLERK
24-DEC-97
117 Tobias
PU_CLERK
24-JUL-97
118 Himuro
PU_CLERK
15-NOV-98
119 Colmenares
PU_CLERK
10-AUG-99
120 Weiss
ST_MAN
18-JUL-96
121 Fripp
ST_MAN
10-APR-97
122 Kaufling
ST_MAN
01-MAY-95
123 Vollman
ST_MAN
10-OCT-97
124 Mourgos
ST_MAN
16-NOV-99
125 Nayer
ST_CLERK
16-JUL-97
126 Mikkilineni
ST_CLERK
28-SEP-98
127 Landry
ST_CLERK
14-JAN-99
128 Markle
ST_CLERK
08-MAR-00
129 Bissot
ST_CLERK
20-AUG-97
130 Atkinson
ST_CLERK
30-OCT-97
131 Marlow
ST_CLERK
16-FEB-97
132 Olson
ST_CLERK
10-APR-99
133 Mallin
ST_CLERK
14-JUN-96
134 Rogers
ST_CLERK
26-AUG-98
135 Gee
ST_CLERK
12-DEC-99
136 Philtanker
ST_CLERK
06-FEB-00
137 Ladwig
ST_CLERK
14-JUL-95
138 Stiles
ST_CLERK
26-OCT-97
139 Seo
ST_CLERK
12-FEB-98
140 Patel
ST_CLERK
06-APR-98
141 Rajs
ST_CLERK
17-OCT-95
142 Davies
ST_CLERK
29-JAN-97
143 Matos
ST_CLERK
15-MAR-98
144 Vargas
ST_CLERK
09-JUL-98
145 Russell
SA_MAN
01-OCT-96
146 Partners
SA_MAN
05-JAN-97
147 Errazuriz
SA_MAN
10-MAR-97
148 Cambrault
SA_MAN
15-OCT-99
149 Zlotkey
SA_MAN
29-JAN-00
150 Tucker
SA_REP
30-JAN-97
151 Bernstein
SA_REP
24-MAR-97
152 Hall
SA_REP
20-AUG-97
153 Olsen
SA_REP
30-MAR-98
154 Cambrault
SA_REP
09-DEC-98
155 Tuvault
SA_REP
23-NOV-99
156 King
SA_REP
30-JAN-96
157 Sully
SA_REP
04-MAR-96
158 McEwen
SA_REP
01-AUG-96
159 Smith
SA_REP
10-MAR-97
160 Doran
SA_REP
15-DEC-97
161 Sewall
SA_REP
03-NOV-98
162 Vishney
SA_REP
11-NOV-97
163 Greene
SA_REP
19-MAR-99
164 Marvins
SA_REP
24-JAN-00
165 Lee
SA_REP
23-FEB-00
166 Ande
SA_REP
24-MAR-00
167 Banda
SA_REP
21-APR-00
168 Ozer
SA_REP
11-MAR-97
169 Bloom
SA_REP
23-MAR-98
170 Fox
SA_REP
24-JAN-98
171 Smith
SA_REP
23-FEB-99
172 Bates
SA_REP
24-MAR-99
173 Kumar
SA_REP
21-APR-00
174 Abel
SA_REP
11-MAY-96
175 Hutton
SA_REP
19-MAR-97
176 Taylor
SA_REP
24-MAR-98
177 Livingston
SA_REP
23-APR-98
178 Grant
SA_REP
24-MAY-99
179 Johnson
SA_REP
04-JAN-00
180 Taylor
SH_CLERK
24-JAN-98
181 Fleaur
SH_CLERK
23-FEB-98
182 Sullivan
SH_CLERK
21-JUN-99
183 Geoni
SH_CLERK
03-FEB-00
184 Sarchand
SH_CLERK
27-JAN-96
185 Bull
SH_CLERK
20-FEB-97
186 Dellinger
SH_CLERK
24-JUN-98
187 Cabrio
SH_CLERK
07-FEB-99
188 Chung
SH_CLERK
14-JUN-97
189 Dilly
SH_CLERK
13-AUG-97
190 Gates
SH_CLERK
11-JUL-98
191 Perkins
SH_CLERK
19-DEC-99
192 Bell
SH_CLERK
04-FEB-96
193 Everett
SH_CLERK
03-MAR-97
194 McCain
SH_CLERK
01-JUL-98
195 Jones
SH_CLERK
17-MAR-99
196 Walsh
SH_CLERK
24-APR-98
197 Feeney
SH_CLERK
23-MAY-98
198 OConnell
SH_CLERK
21-JUN-99
199 Grant
SH_CLERK
13-JAN-00
200 Whalen
AD_ASST
17-SEP-87
201 Hartstein
MK_MAN
17-FEB-96
202 Fay
MK_REP
17-AUG-97
203 Mavris
HR_REP
07-JUN-94
204 Baer
PR_REP
07-JUN-94
205 Higgins
AC_MGR
07-JUN-94
206 Gietz
AC_ACCOUNT 07-JUN-94
Sciarra,FI_ACCOUNT
Urman,FI_ACCOUNT
Popp,FI_ACCOUNT
Raphaely,PU_MAN
Khoo,PU_CLERK
Baida,PU_CLERK
Tobias,PU_CLERK
Himuro,PU_CLERK
Colmenares,PU_CLERK
Weiss,ST_MAN
Fripp,ST_MAN
Kaufling,ST_MAN
Vollman,ST_MAN
Mourgos,ST_MAN
Nayer,ST_CLERK
Mikkilineni,ST_CLERK
Landry,ST_CLERK
Markle,ST_CLERK
Bissot,ST_CLERK
Atkinson,ST_CLERK
Marlow,ST_CLERK
Olson,ST_CLERK
Mallin,ST_CLERK
Rogers,ST_CLERK
Gee,ST_CLERK
Philtanker,ST_CLERK
Ladwig,ST_CLERK
Stiles,ST_CLERK
Seo,ST_CLERK
Patel,ST_CLERK
Rajs,ST_CLERK
Davies,ST_CLERK
Matos,ST_CLERK
Vargas,ST_CLERK
Russell,SA_MAN
Partners,SA_MAN
Errazuriz,SA_MAN
Cambrault,SA_MAN
Zlotkey,SA_MAN
Tucker,SA_REP
Bernstein,SA_REP
Hall,SA_REP
Olsen,SA_REP
Cambrault,SA_REP
Tuvault,SA_REP
King,SA_REP
Sully,SA_REP
McEwen,SA_REP
Smith,SA_REP
Doran,SA_REP
Sewall,SA_REP
Vishney,SA_REP
Greene,SA_REP
Marvins,SA_REP
Lee,SA_REP
Ande,SA_REP
Banda,SA_REP
Ozer,SA_REP
Bloom,SA_REP
Fox,SA_REP
Smith,SA_REP
Bates,SA_REP
Kumar,SA_REP
Abel,SA_REP
Hutton,SA_REP
Taylor,SA_REP
Livingston,SA_REP
Grant,SA_REP
Johnson,SA_REP
Taylor,SH_CLERK
Fleaur,SH_CLERK
Sullivan,SH_CLERK
Geoni,SH_CLERK
Sarchand,SH_CLERK
Bull,SH_CLERK
Dellinger,SH_CLERK
Cabrio,SH_CLERK
Chung,SH_CLERK
Dilly,SH_CLERK
Gates,SH_CLERK
Perkins,SH_CLERK
Bell,SH_CLERK
Everett,SH_CLERK
McCain,SH_CLERK
Jones,SH_CLERK
Walsh,SH_CLERK
Feeney,SH_CLERK
OConnell,SH_CLERK
Grant,SH_CLERK
Whalen,AD_ASST
Hartstein,MK_MAN
Fay,MK_REP
Mavris,HR_REP
Baer,PR_REP
Higgins,AC_MGR
Gietz,AC_ACCOUNT
FIRST_NAME
VARCHAR2(20)
LAST_NAME
NOT NULL VARCHAR2(25)
EMAIL
NOT NULL VARCHAR2(25)
PHONE_NUMBER
VARCHAR2(20)
HIRE_DATE
NOT NULL DATE
JOB_ID
NOT NULL VARCHAR2(10)
SALARY
NUMBER(8,2)
COMMISSION_PCT
NUMBER(2,2)
MANAGER_ID
NUMBER(6)
DEPARTMENT_ID
NUMBER(4)
SQL> select employee_id||','||first_name||','||last_name||','||email||','||phone
_number||','||hire_date||','||job_id||','||salary||','||commission_pct||','||man
ager_id||','||department_id from employees;
EMPLOYEE_ID||','||FIRST_NAME||','||LAST_NAME||','||EMAIL||','||PHONE_NUMBER||','
||HIRE_DATE||','||JOB_ID||','||SALARY||','||COMMISSION_PCT||','||MANAGER_ID||','
||DEPARTMENT_ID
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------100,Steven,King,SKING,515.123.4567,17-JUN-87,AD_PRES,24000,,,90
101,Neena,Kochhar,NKOCHHAR,515.123.4568,21-SEP-89,AD_VP,17000,,100,90
102,Lex,De Haan,LDEHAAN,515.123.4569,13-JAN-93,AD_VP,17000,,100,90
103,Alexander,Hunold,AHUNOLD,590.423.4567,03-JAN-90,IT_PROG,9000,,102,60
104,Bruce,Ernst,BERNST,590.423.4568,21-MAY-91,IT_PROG,6000,,103,60
105,David,Austin,DAUSTIN,590.423.4569,25-JUN-97,IT_PROG,4800,,103,60
106,Valli,Pataballa,VPATABAL,590.423.4560,05-FEB-98,IT_PROG,4800,,103,60
107,Diana,Lorentz,DLORENTZ,590.423.5567,07-FEB-99,IT_PROG,4200,,103,60
108,Nancy,Greenberg,NGREENBE,515.124.4569,17-AUG-94,FI_MGR,12000,,101,100
109,Daniel,Faviet,DFAVIET,515.124.4169,16-AUG-94,FI_ACCOUNT,9000,,108,100
110,John,Chen,JCHEN,515.124.4269,28-SEP-97,FI_ACCOUNT,8200,,108,100
111,Ismael,Sciarra,ISCIARRA,515.124.4369,30-SEP-97,FI_ACCOUNT,7700,,108,100
112,Jose Manuel,Urman,JMURMAN,515.124.4469,07-MAR-98,FI_ACCOUNT,7800,,108,100
113,Luis,Popp,LPOPP,515.124.4567,07-DEC-99,FI_ACCOUNT,6900,,108,100
114,Den,Raphaely,DRAPHEAL,515.127.4561,07-DEC-94,PU_MAN,11000,,100,30
115,Alexander,Khoo,AKHOO,515.127.4562,18-MAY-95,PU_CLERK,3100,,114,30
116,Shelli,Baida,SBAIDA,515.127.4563,24-DEC-97,PU_CLERK,2900,,114,30
117,Sigal,Tobias,STOBIAS,515.127.4564,24-JUL-97,PU_CLERK,2800,,114,30
118,Guy,Himuro,GHIMURO,515.127.4565,15-NOV-98,PU_CLERK,2600,,114,30
119,Karen,Colmenares,KCOLMENA,515.127.4566,10-AUG-99,PU_CLERK,2500,,114,30
120,Matthew,Weiss,MWEISS,650.123.1234,18-JUL-96,ST_MAN,8000,,100,50
121,Adam,Fripp,AFRIPP,650.123.2234,10-APR-97,ST_MAN,8200,,100,50
122,Payam,Kaufling,PKAUFLIN,650.123.3234,01-MAY-95,ST_MAN,7900,,100,50
123,Shanta,Vollman,SVOLLMAN,650.123.4234,10-OCT-97,ST_MAN,6500,,100,50
124,Kevin,Mourgos,KMOURGOS,650.123.5234,16-NOV-99,ST_MAN,5800,,100,50
125,Julia,Nayer,JNAYER,650.124.1214,16-JUL-97,ST_CLERK,3200,,120,50
126,Irene,Mikkilineni,IMIKKILI,650.124.1224,28-SEP-98,ST_CLERK,2700,,120,50
127,James,Landry,JLANDRY,650.124.1334,14-JAN-99,ST_CLERK,2400,,120,50
128,Steven,Markle,SMARKLE,650.124.1434,08-MAR-00,ST_CLERK,2200,,120,50
129,Laura,Bissot,LBISSOT,650.124.5234,20-AUG-97,ST_CLERK,3300,,121,50
130,Mozhe,Atkinson,MATKINSO,650.124.6234,30-OCT-97,ST_CLERK,2800,,121,50
131,James,Marlow,JAMRLOW,650.124.7234,16-FEB-97,ST_CLERK,2500,,121,50
132,TJ,Olson,TJOLSON,650.124.8234,10-APR-99,ST_CLERK,2100,,121,50
133,Jason,Mallin,JMALLIN,650.127.1934,14-JUN-96,ST_CLERK,3300,,122,50
134,Michael,Rogers,MROGERS,650.127.1834,26-AUG-98,ST_CLERK,2900,,122,50
135,Ki,Gee,KGEE,650.127.1734,12-DEC-99,ST_CLERK,2400,,122,50
136,Hazel,Philtanker,HPHILTAN,650.127.1634,06-FEB-00,ST_CLERK,2200,,122,50
137,Renske,Ladwig,RLADWIG,650.121.1234,14-JUL-95,ST_CLERK,3600,,123,50
138,Stephen,Stiles,SSTILES,650.121.2034,26-OCT-97,ST_CLERK,3200,,123,50
139,John,Seo,JSEO,650.121.2019,12-FEB-98,ST_CLERK,2700,,123,50
140,Joshua,Patel,JPATEL,650.121.1834,06-APR-98,ST_CLERK,2500,,123,50
141,Trenna,Rajs,TRAJS,650.121.8009,17-OCT-95,ST_CLERK,3500,,124,50
142,Curtis,Davies,CDAVIES,650.121.2994,29-JAN-97,ST_CLERK,3100,,124,50
143,Randall,Matos,RMATOS,650.121.2874,15-MAR-98,ST_CLERK,2600,,124,50
144,Peter,Vargas,PVARGAS,650.121.2004,09-JUL-98,ST_CLERK,2500,,124,50
145,John,Russell,JRUSSEL,011.44.1344.429268,01-OCT-96,SA_MAN,14000,.4,100,80
146,Karen,Partners,KPARTNER,011.44.1344.467268,05-JAN-97,SA_MAN,13500,.3,100,80
147,Alberto,Errazuriz,AERRAZUR,011.44.1344.429278,10-MAR-97,SA_MAN,12000,.3,100,
80
148,Gerald,Cambrault,GCAMBRAU,011.44.1344.619268,15-OCT-99,SA_MAN,11000,.3,100,8
0
149,Eleni,Zlotkey,EZLOTKEY,011.44.1344.429018,29-JAN-00,SA_MAN,10500,.2,100,80
150,Peter,Tucker,PTUCKER,011.44.1344.129268,30-JAN-97,SA_REP,10000,.3,145,80
151,David,Bernstein,DBERNSTE,011.44.1344.345268,24-MAR-97,SA_REP,9500,.25,145,80
152,Peter,Hall,PHALL,011.44.1344.478968,20-AUG-97,SA_REP,9000,.25,145,80
153,Christopher,Olsen,COLSEN,011.44.1344.498718,30-MAR-98,SA_REP,8000,.2,145,80
154,Nanette,Cambrault,NCAMBRAU,011.44.1344.987668,09-DEC-98,SA_REP,7500,.2,145,8
0
155,Oliver,Tuvault,OTUVAULT,011.44.1344.486508,23-NOV-99,SA_REP,7000,.15,145,80
156,Janette,King,JKING,011.44.1345.429268,30-JAN-96,SA_REP,10000,.35,146,80
157,Patrick,Sully,PSULLY,011.44.1345.929268,04-MAR-96,SA_REP,9500,.35,146,80
158,Allan,McEwen,AMCEWEN,011.44.1345.829268,01-AUG-96,SA_REP,9000,.35,146,80
159,Lindsey,Smith,LSMITH,011.44.1345.729268,10-MAR-97,SA_REP,8000,.3,146,80
160,Louise,Doran,LDORAN,011.44.1345.629268,15-DEC-97,SA_REP,7500,.3,146,80
161,Sarath,Sewall,SSEWALL,011.44.1345.529268,03-NOV-98,SA_REP,7000,.25,146,80
162,Clara,Vishney,CVISHNEY,011.44.1346.129268,11-NOV-97,SA_REP,10500,.25,147,80
163,Danielle,Greene,DGREENE,011.44.1346.229268,19-MAR-99,SA_REP,9500,.15,147,80
164,Mattea,Marvins,MMARVINS,011.44.1346.329268,24-JAN-00,SA_REP,7200,.1,147,80
165,David,Lee,DLEE,011.44.1346.529268,23-FEB-00,SA_REP,6800,.1,147,80
166,Sundar,Ande,SANDE,011.44.1346.629268,24-MAR-00,SA_REP,6400,.1,147,80
167,Amit,Banda,ABANDA,011.44.1346.729268,21-APR-00,SA_REP,6200,.1,147,80
168,Lisa,Ozer,LOZER,011.44.1343.929268,11-MAR-97,SA_REP,11500,.25,148,80
169,Harrison,Bloom,HBLOOM,011.44.1343.829268,23-MAR-98,SA_REP,10000,.2,148,80
170,Tayler,Fox,TFOX,011.44.1343.729268,24-JAN-98,SA_REP,9600,.2,148,80
171,William,Smith,WSMITH,011.44.1343.629268,23-FEB-99,SA_REP,7400,.15,148,80
172,Elizabeth,Bates,EBATES,011.44.1343.529268,24-MAR-99,SA_REP,7300,.15,148,80
173,Sundita,Kumar,SKUMAR,011.44.1343.329268,21-APR-00,SA_REP,6100,.1,148,80
174,Ellen,Abel,EABEL,011.44.1644.429267,11-MAY-96,SA_REP,11000,.3,149,80
175,Alyssa,Hutton,AHUTTON,011.44.1644.429266,19-MAR-97,SA_REP,8800,.25,149,80
176,Jonathon,Taylor,JTAYLOR,011.44.1644.429265,24-MAR-98,SA_REP,8600,.2,149,80
177,Jack,Livingston,JLIVINGS,011.44.1644.429264,23-APR-98,SA_REP,8400,.2,149,80
178,Kimberely,Grant,KGRANT,011.44.1644.429263,24-MAY-99,SA_REP,7000,.15,149,
179,Charles,Johnson,CJOHNSON,011.44.1644.429262,04-JAN-00,SA_REP,6200,.1,149,80
180,Winston,Taylor,WTAYLOR,650.507.9876,24-JAN-98,SH_CLERK,3200,,120,50
181,Jean,Fleaur,JFLEAUR,650.507.9877,23-FEB-98,SH_CLERK,3100,,120,50
182,Martha,Sullivan,MSULLIVA,650.507.9878,21-JUN-99,SH_CLERK,2500,,120,50
183,Girard,Geoni,GGEONI,650.507.9879,03-FEB-00,SH_CLERK,2800,,120,50
184,Nandita,Sarchand,NSARCHAN,650.509.1876,27-JAN-96,SH_CLERK,4200,,121,50
185,Alexis,Bull,ABULL,650.509.2876,20-FEB-97,SH_CLERK,4100,,121,50
186,Julia,Dellinger,JDELLING,650.509.3876,24-JUN-98,SH_CLERK,3400,,121,50
187,Anthony,Cabrio,ACABRIO,650.509.4876,07-FEB-99,SH_CLERK,3000,,121,50
188,Kelly,Chung,KCHUNG,650.505.1876,14-JUN-97,SH_CLERK,3800,,122,50
189,Jennifer,Dilly,JDILLY,650.505.2876,13-AUG-97,SH_CLERK,3600,,122,50
190,Timothy,Gates,TGATES,650.505.3876,11-JUL-98,SH_CLERK,2900,,122,50
191,Randall,Perkins,RPERKINS,650.505.4876,19-DEC-99,SH_CLERK,2500,,122,50
192,Sarah,Bell,SBELL,650.501.1876,04-FEB-96,SH_CLERK,4000,,123,50
193,Britney,Everett,BEVERETT,650.501.2876,03-MAR-97,SH_CLERK,3900,,123,50
194,Samuel,McCain,SMCCAIN,650.501.3876,01-JUL-98,SH_CLERK,3200,,123,50
195,Vance,Jones,VJONES,650.501.4876,17-MAR-99,SH_CLERK,2800,,123,50
196,Alana,Walsh,AWALSH,650.507.9811,24-APR-98,SH_CLERK,3100,,124,50
197,Kevin,Feeney,KFEENEY,650.507.9822,23-MAY-98,SH_CLERK,3000,,124,50
198,Donald,OConnell,DOCONNEL,650.507.9833,21-JUN-99,SH_CLERK,2600,,124,50
199,Douglas,Grant,DGRANT,650.507.9844,13-JAN-00,SH_CLERK,2600,,124,50
200,Jennifer,Whalen,JWHALEN,515.123.4444,17-SEP-87,AD_ASST,4400,,101,10
201,Michael,Hartstein,MHARTSTE,515.123.5555,17-FEB-96,MK_MAN,13000,,100,20
202,Pat,Fay,PFAY,603.123.6666,17-AUG-97,MK_REP,6000,,201,20
203,Susan,Mavris,SMAVRIS,515.123.7777,07-JUN-94,HR_REP,6500,,101,40
204,Hermann,Baer,HBAER,515.123.8888,07-JUN-94,PR_REP,10000,,101,70
205,Shelley,Higgins,SHIGGINS,515.123.8080,07-JUN-94,AC_MGR,12000,,101,110
206,William,Gietz,WGIETZ,515.123.8181,07-JUN-94,AC_ACCOUNT,8300,,205,110