Search
 
SCRIPT & CODE EXAMPLE
 

SQL

sql limit results returned

-- 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

PREVIOUS NEXT
Code Example
Sql :: postgres copy table from one schema to another 
Sql :: mysql database manager 
Sql :: laravel get sql query eloquent with parameters 
Sql :: snap remove mysql workbench 
Sql :: mysql add text to existing field 
Sql :: sql identity column reset 
Sql :: query less than datetime sql 
Sql :: plsql triggers 
Sql :: how to unlock table in sql server 
Sql :: dateadd in sql 
Sql :: how to truncate all table in mysql workbench 
Sql :: mysql row_number() example 
Sql :: how to truncate table with foreign key constraint postgresql 
Sql :: mysql where value is null 
Sql :: create new schema mysql 
Sql :: drop table if exists test 
Sql :: 3 days back in sql server 
Sql :: oracle timestamp to date 
Sql :: mysql export and import 
Sql :: how to show index type in postgresql 
Sql :: oracle list dates without weekends 
Sql :: zsh-syntax-highlighting zsh-autosuggestions 
Sql :: events mysql 
Sql :: phone no data type in sql server 
Sql :: mysql delete table with foreign key 
Sql :: rename table sql server 
Sql :: psql select database 
Sql :: mysql select date range last 30 days 
Sql :: postgresql delete limit 
Sql :: Add a column with a default value to an existing table in SQL Server 
ADD CONTENT
Topic
Content
Source link
Name
3+6 =