SQL Server Interview Questions and Answers
<< Previous Question Next Question >>
 Question: 660 Page Views: 

Write a query to select first 20 rows from a table having 100 rows?



Posted By: Avi Date: 1 October 2010 12:19:08 PM
 Answer:

Select top 20 from table_name or Select * from table_name where count(*) <=20


Posted By: avibtech


Date: 1 October 2010 12:19:08 PM
Post a better Answer if you have
 
(Will show your Gravatar icon)  
  Country flag

Loading
Enter the text as shown in the image F4Np1v
Related Questions
SQL Server : Why we use SET ROWCOUNT statement in SQL Server?

Why we use SET ROWCOUNT statement in SQL Server?

It causes SQL Server to stop processing the query after the specified number of rows (e.g. SET ROWCO....
Category: SQL Server Date: 10/2/2009 7:03:39 AM
SQL Server : How can we delete the duplicate rows from a  table?

How can we delete the duplicate rows from a table?

Lets consider if we have a table Employee with rowid, name and email columns. Then we can use follow....
Category: SQL Server Date: 9/19/2009 4:58:46 AM
SQL Server : How can we find the number of rows in a table?

How can we find the number of rows in a table?

Following SQL statements can be used to get the number of rows in a table: SQL Query - 1: SELECT CO....
Category: SQL Server Date: 9/19/2009 4:51:20 AM
SQL Server : Write down the general syntax for a SELECT statement covering all the options.

Write down the general syntax for a SELECT statement covering all the options.

SELECT select_list [INTO new_table] FROM table_source [WHERE search_condition] [GROUP BY group_by_ex....
Category: SQL Server Date: 9/19/2009 4:24:23 AM
SQL Server : Whatis the difference between DELETE TABLE and TRUNCATE TABLE commands?

Whatis the difference between DELETE TABLE and TRUNCATE TABLE commands?

DELETE TABLE command is used to delete all the rows in a table. It is a logged operation, means the ....
Category: SQL Server Date: 9/19/2009 4:17:27 AM