oracle select first result

SELECT * FROM (SELECT [COLUMNS] FROM [TABLE] ORDER BY [DATE] DESC)
    WHERE ROWNUM = 1;
-- Oracle 12c:
SELECT * FROM (SELECT [COLUMNS] FROM [TABLE] ORDER BY [DATE] DESC) 
    FETCH FIRST 1 ROW ONLY;
SELECT * FROM (SELECT [COLUMNS] FROM [TABLE] ORDER BY [DATE] DESC) 
    FETCH FIRST 10 ROW ONLY;
SELECT * FROM (SELECT [COLUMNS] FROM [TABLE] ORDER BY [DATE] DESC) 
    FETCH FIRST 10 ROWS ONLY;

4
4
IllusiveBrian 18110 points

                                    -- NOTE: This is for Oracle/PLSQL only

-- > EXAMPLE
select * 
from CONSUMERS
where ROWNUM <= 1

/*
-- > SYNTAX
select * 
from {yourTable}
where ROWNUM <= {number-of-rows}

*/

4 (4 Votes)
0
Are there any code examples left?
Create a Free Account
Unlock the power of data and AI by diving into Python, ChatGPT, SQL, Power BI, and beyond.
Sign up
Develop soft skills on BrainApps
Complete the IQ Test
Relative searches
sql first select the first row in oracle obtain first row oracle query oracle just get first row how to print the first row in oracle select first 10 rows in oracle sql developer first 10 rows in oracle sql FIRST ROW IN ORACLE select first record oracle sql select first 10 records in oracle understanding first_rows oracle first_rows oracle oracle get first row from query how to select first 10 rows in sql oracle HOW TO SELECT FIRST ROW OF EACH TYPE IN ORACLE Oracle 12 Syntax: fetch first row first row in oracle print the first rowin oracle 11g oracle first row only first row in oracle SELECT FIRST ORACLE oracle sql how to select first row return first row oracle 11g select first row in oracle sql select first 10 rows oracle oracle select first n rows oracle select first 10 rows oracle fetch first row only oracle select first result oracle sql first row only select first 10 rows in oracle sql first row oracle return first row in oracle' oracle - get first row oracle sql first row oracle sql select first 10 rows show only the first row oracle sql select first row sql oracle select first row oracle sql oracle fetch 1 row with column only select first row in oracle oracle first row only oracle sql select first take first result pl/sql select first element into pl/sql select first result into pl/sql how to get first row oracle oracle sql fetch only first row select first row oracle Oracle get first row oracle first row select oracle first row oracle retorn to one line oracle select all but first row oracl sql entry oracle select first row
Made with love
This website uses cookies to make IQCode work for you. By using this site, you agree to our cookie policy

Welcome Back!

Sign up to unlock all of IQCode features:
  • Test your skills and track progress
  • Engage in comprehensive interactive courses
  • Commit to daily skill-enhancing challenges
  • Solve practical, real-world issues
  • Share your insights and learnings
Create an account
Sign in
Recover lost password
Or log in with

Create a Free Account

Sign up to unlock all of IQCode features:
  • Test your skills and track progress
  • Engage in comprehensive interactive courses
  • Commit to daily skill-enhancing challenges
  • Solve practical, real-world issues
  • Share your insights and learnings
Create an account
Sign up
Or sign up with
By signing up, you agree to the Terms and Conditions and Privacy Policy. You also agree to receive product-related marketing emails from IQCode, which you can unsubscribe from at any time.
Creating a new code example
Code snippet title
Source