Posts

Showing posts from December, 2018
Image
How to use rownum correctly in Oracle SQL ? by Rocky Jagtiani Oracle Certified Associate I train on Oracle Certification from last 7 years This is one such question , which freshers face a lot at on+off-campus interviews. The concept of rownum is quite simple. For each row returned by a query, the ROWNUM pseudocolumn returns a number indicating the order in which Oracle selects the row from a table or set of joined rows. The first row selected has a ROWNUM of 1, the second has 2, and so on. You can use ROWNUM to limit the number of rows returned by a query, as in this example: SELECT employee_id, first_name FROM Top_N_employees WHERE ROWNUM < 10; You would notice only 9 rows (as the condition is < 10). Contents : [ 20 mins read & execute ] 1> How to use rownum ? 2> Where not to use rownum ? 3> Face the most common interview question. For beginners, who wish get the schema and records of my test table : Top_N_employees , do see