Professional Documents
Culture Documents
Practice 6: Employee - Id Last - Name
Practice 6: Employee - Id Last - Name
1. Write a query to display the last name and hire date of any employee in the same
department as Zlotkey. Exclude Zlotkey.
employee_id last_name
100 King
101 Kochhar
103 Hunold
108 Greenberg
109 Faviet
110 Chen
111 Sciarra
112 Urman
113 Popp
114 Raphaely
120 Weiss
121 Fripp
122 Kaufling
123 Vollman
145 Russell
146 Partners
148 Cambrault
149 Zlotkey
150 Tucker
151 Bernstein
152 Hall
153 Olsen
154 Cambrault
155 Tuvault
156 King
157 Sully
158 McEwen
159 Smith
160 Doran
161 Sewall
163 Greene
164 Marvins
165 Lee
168 Ozer
169 Bloom
170 Fox
171 Smith
172 Bates
174 Abel
175 Hutton
176 Taylor
177 Livingston
178 Grant
201 Hartstein
204 Baer
205 Higgins
206 Gietz
3. Write a query that displays the employee numbers and last names of all employees who work in a
department with any employee whose last name contains a u. Place your SQL statement in a text file
named lab6_3.sql. Run your query.
employee_id last_name
103 Hunold
104 Ernst
106 Pataballa
107 Lorentz
114 Raphaely
115 Khoo
116 Baida
117 Tobias
118 Himuro
119 Colmenares
120 Weiss
121 Fripp
122 Kaufling
123 Vollman
124 Mourgos
125 Nayer
127 Landry
128 Markle
129 Bissot
130 Atkinson
131 Marlow
132 Olson
133 Mallin
134 Rogers
135 Gee
136 Philtanker
137 Ladwig
138 Stiles
139 Seo
140 Patel
142 Davies
143 Matos
144 Vargas
145 Russell
146 Partners
147 Errazuriz
148 Cambrault
149 Zlotkey
150 Tucker
151 Bernstein
152 Hall
153 Olsen
154 Cambrault
155 Tuvault
157 Sully
158 McEwen
159 Smith
160 Doran
161 Sewall
162 Vishney
163 Greene
164 Marvins
165 Lee
166 Ande
167 Banda
168 Ozer
169 Bloom
170 Fox
172 Bates
173 Kumar
174 Abel
175 Hutton
176 Taylor
177 Livingston
179 Johnson
180 Taylor
181 Fleaur
182 Sullivan
183 Geoni
184 Sarchand
185 Bull
186 Dellinger
188 Chung
189 Dilly
190 Gates
191 Perkins
192 Bell
193 Everett
194 McCain
195 Jones
196 Walsh
197 Feeney
198 OConnell
199 Grant
4. Display the last name, department number, and job ID of all employees whose
department location ID is 1700.
King 90 AD_PRES
Kochhar 90 AD_VP
De Haan 90 AD_VP
Raphaely 30 PU_MAN
Khoo 30 PU_CLERK
Baida 30 PU_CLERK
Tobias 30 PU_CLERK
Himuro 30 PU_CLERK
Colmenares 30 PU_CLERK
Whalen 10 AD_ASST
5. Display the last name and salary of every employee who reports to King.
FROM employees
Introduction to Oracle9i: SQL 6-32
WHERE manager_id = (SELECT employee_id
FROM employees
6. Display the department number, last name, and job ID for every employee in the Executive
department.
90 King AD_PRES
90 Kochhar AD_VP
90 De Haan AD_VP
7. Modify the query in lab6_3.sql to display the employee numbers, last names, and salaries of all
employees who earn more than the average salary and who work in a department with any
employee with a u in their name. Resave lab6_3.sql to lab6_7.sql. Run the statement in
lab6_7.sql.