Search
 
SCRIPT & CODE EXAMPLE
 

SQL

sql limit to 5 results

-- MySql
SELECT * FROM emp ORDER BY sal DESC LIMIT 5;	
-- SQL Server 
SELECT TOP 5 * FROM emp ORDER BY sal DESC;	
-- Oracle < 11g 
SELECT * FROM ( SELECT * FROM emp ORDER BY sal DESC ) WHERE ROWNUM <= 5;
-- Oracle 12c +
SELECT * FROM emp ORDER BY sal DESC FETCH FIRST 5 ROWS ONLY;	
Comment

sql limit to 5 results

SELECT expressions
FROM tables
[WHERE conditions]
[ORDER BY expression [ ASC | DESC ]]
LIMIT number_rows [ OFFSET offset_value ];
Comment

PREVIOUS NEXT
Code Example
Sql :: list mysql tables and views 
Sql :: select indexes postgres 
Sql :: sql exemplos 
Sql :: how to create triggers in sql server 
Sql :: delete record mysql 
Sql :: insert data from one database table to another database table in postgresql using pgadmin 
Sql :: sqlalchemy case insensitive like 
Sql :: sql select on string 
Sql :: minus equivalent in my sql 
Sql :: how to find sql server installation folder 
Sql :: sql rownum 
Sql :: t-sql never ending delete 
Sql :: connect to mysql server mac terminal 
Sql :: sql foreign key constraint 
Sql :: select year from dual oracle 
Sql :: update field in sql to null 
Sql :: top frequency in sql server 
Sql :: sqlite3 visual table schema 
Sql :: how to show current database in mysql 
Sql :: create directory in sql server 
Sql :: oracle undo usage per session 
Sql :: postgresql insert multiple rows 
Sql :: java.sql.sqlexception: the url cannot be null 
Sql :: oracle add attribute to table 
Sql :: create a table from one field of another table 
Sql :: sql server epoch to datetime 
Sql :: substract variable amount of minutes from timestamp postgresql 
Sql :: google sheets filter rows above current cell 
Sql :: access refused mysql xampp server 
Sql :: sqlalchemy query join many to many 
ADD CONTENT
Topic
Content
Source link
Name
8+4 =