Skip to content

Tarik Billa

  • Web Development
    • html
    • vue.js
    • laravel
    • css
    • javascript
    • jquery
    • node.js
    • php
    • asp.net
  • Programming
    • python
    • java
    • c
    • c++
    • c#
  • git
  • android

sql-limit

How do I do top 1 in Oracle? [duplicate]

October 2, 2022 by Tarik

If you want just a first selected row, you can: select fname from MyTbl where rownum = 1 You can also use analytic functions to order and take the top x: select max(fname) over (rank() order by some_factor) from MyTbl

Categories sql Tags oracle, oracle11g, sql, sql-limit Leave a comment

How to get the top 10 values in postgresql?

September 22, 2022 by Tarik

For this you can use limit select * from scores order by score desc limit 10 If performance is important (when is it not 😉 look for an index on score. Starting with version 8.4, you can also use the standard (SQL:2008) fetch first select * from scores order by score desc fetch first 10 … Read more

Categories sql Tags postgresql, sql, sql-limit Leave a comment

How do I limit the number of rows returned by an Oracle query after ordering?

August 30, 2022 by Tarik

You can use a subquery for this like select * from ( select * from emp order by sal desc ) where ROWNUM <= 5; Have also a look at the topic On ROWNUM and limiting results at Oracle/AskTom for more information. Update: To limit the result with both lower and upper bounds things get … Read more

Categories sql Tags oracle, pagination, sql, sql-limit Leave a comment
Newer posts
← Previous Page1 Page2

Tarik Billa

Software Engineer
tarikbilla@gmail.com
+8801884414000
  • Reuse a hash in YAMLApril 17, 2024
  • Dockerfile: how to redirect the output of a RUN command to a variable?April 16, 2024
  • How to cd to a directory with spaces in the directory name?April 16, 2024
  • Maximum MIME type length when storing the type in a databaseApril 16, 2024
  • What is the difference between Unit, Integration, Regression and Acceptance Testing?April 16, 2024
© 2026 Tarik Billa