PDA

View Full Version : doubt regarding SQL



65daysofstatic
April 16th, 2009, 02:19 AM
hi,

I am new to SQL, and I am wondering if there's a way to select the first tuple/row of a table.

65dos.

cabalas
April 16th, 2009, 02:24 AM
This code should select the first row from a table


select * from table_name limit 1

CptPicard
April 16th, 2009, 02:25 AM
First of all, without an order by clause, SQL does not specify an ordering, so there is no well-defined "first" row. Otherwise, use a "LIMIT 1" at the end of the query.

65daysofstatic
April 16th, 2009, 02:53 AM
lol sql server doesn't support the clause limit but it helped me to find the clause set rowcount and top.

Thank you.