SQL Needed For Selecting Only 10 Records,Can Anyone Help Me?

4

4 Answers

JJJJJJ BBBBBB Profile
JJJJJJ BBBBBB answered
In SQL Server the simplest method is to use "SELECT TOP 10 * FROM MYTABLENAME".
Naeem Sheeraz Profile
Naeem Sheeraz answered
There are lots of ways to select first desired record or row from a database table. Here are some example SQL statements

That doesn't require additional application logic, but each database server requires different SQL syntax.

SELECT ROWNUM,column1,column2,column3
FROM table_name
WHERE ROWNUM
thanked the writer.
james blowfelt
james blowfelt commented
Well The ANSI standerd is after evreything else (SELECT nn FROM ... WHERE ... ORDER by ... LIMIT 0,10 then the ; at the end NB, LIMIT works like this LIMIT (From Record , for x records) Honest hurt my head thiniking from record x to y that's just WORNG but we all learn
PREM KRISHNAN Profile
PREM KRISHNAN answered
Select * from fetch first 10 rows only.

This is the query can be used when your database is DB2 .
Mahendra gautam Profile
Mahendra gautam answered
In sql table define some primary key as emp_code

select * from tablename where emp_code between range1 and range2

Answer Question

Anonymous