Sql> select employee_id,first_name, department_id
2 from
3 (
4 select e.employee_id,e.first_name,d.department_id,
5 row_number() over (partition by d.department_id order by d.department_id asc) rn
6 from employees e,departments d
7 where e.department_id=d.department_id
8 order by d.department_id asc
9 )
10 where rn = 1;
EMPLOYEE_ID FIRST_NAME DEPARTMENT_ID
----------- -------------------- -------------
200 Jennifer 10
201 Michael 20
114 Den 30
203 Susan 40
198 Donald 50
103 Alexander 60
204 Hermann 70
145 John 80
100 Steven 90
108 Nancy 100
205 Shelley 110
11 rows selected.
Halim, a Georgia Tech graduate Senior Database Engineer/Data Architect based in Atlanta, USA, is an Oracle OCP DBA and Developer, Certified Cloud Architect Professional, and OCI Autonomous Database Specialist. With extensive expertise in database design, configuration, tuning, capacity planning, RAC, DG, scripting, Python, APEX, and PL/SQL, he combines technical mastery with a passion for innovation. Notably, Halim secured 16th place worldwide in PL/SQL Challenge Cup Playoff on the year 2010.
Friday, September 11, 2009
Subscribe to:
Post Comments (Atom)
My Blog List
-
-
-
Coalesce SQ bug3 weeks ago
-
UKOUG Discover 20244 months ago
-
-
-
-
-
-
-
-
Moving Sideways8 years ago
-
-
Upcoming Events...11 years ago
-
No comments:
Post a Comment