Limit the number of rows in DB

How can I limit the number of rows in DB2, MySQL, Oracle, SQL Server

in Oracle:
SELECT * FROM Table_Name where rownum <= 5

in DB2:
SELECT * FROM Table_Name fetch first 5 rows only

in MySQL:
SELECT * FROM Table_Name limit 5

in SQL Server:
SELECT TOP 5 * from Table_Name

hopefully useful… 🙂


About davidand

Hi, welcome to my blogs. My name is David Andriansyah. I am currently working as an independent Cognos Business Intelligence consultant, and I also as Freelance Web Developer. View all posts by davidand

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: