Difference between revisions of "ROWNUM()"

From Recital Documentation Wiki
Jump to: navigation, search
m (ROWNUM moved to ROWNUM())
Line 1: Line 1:
 +
''Note: The ROWNUM Pseudo Column has been replaced with the ROWNUM() function.''
 +
 
==Purpose==
 
==Purpose==
Return a number indicating the order in which the rows are selected from the table
+
Function to return a number indicating the order in which the rows are selected from the table
  
  
 
==Syntax==
 
==Syntax==
ROWNUM
+
ROWNUM()
  
  
 
==See Also==
 
==See Also==
[[PSEUDO COLUMNS]], [[SQL INSERT|INSERT]], [[SQL SELECT|SELECT]], [[SQL UPDATE|UPDATE]]
+
[[PSEUDO COLUMNS]], [[RECNO()]], [[SQL INSERT|INSERT]], [[SQL SELECT|SELECT]], [[SQL UPDATE|UPDATE]]
  
  
 
==Description==
 
==Description==
A Pseudo Column behaves like a table column, but is not actually stored in the table. You can select from Pseudo Columns, but they cannot be updated.  Pseudo Columns provide extra information about a SELECT row set.
+
The ROWNUM() function returns a number indicating the order in which the rows are selected from the table.  This can be contrasted with the physical row number in the table.
 
+
The ROWNUM Pseudo Column will return a number indicating the order in which the rows are selected from the table.
+
  
  
 
==Example==
 
==Example==
 
<code lang="recital">
 
<code lang="recital">
// Display all overdue accounts with 15% commission in
+
OPEN DATABASE southwind
// Sorted "name" and "paid date" order with the row number.
+
SELECT rownum(), recno(), state from example where state = "MA"
EXEC SQL
+
SELECT ROWNUM, name, address, balance, cost*1.15
+
FROM accounts
+
WHERE paid_date < date()
+
ORDER BY name, paid_date;
+
 
</code>
 
</code>
  
Line 33: Line 28:
 
[[Category:Documentation]]
 
[[Category:Documentation]]
 
[[Category:SQL]]
 
[[Category:SQL]]
[[Category:Pseudo Columns]]
+
[[Category:FUNCTIONS]]

Revision as of 15:06, 4 July 2011

Note: The ROWNUM Pseudo Column has been replaced with the ROWNUM() function.

Purpose

Function to return a number indicating the order in which the rows are selected from the table


Syntax

ROWNUM()


See Also

PSEUDO COLUMNS, RECNO(), INSERT, SELECT, UPDATE


Description

The ROWNUM() function returns a number indicating the order in which the rows are selected from the table. This can be contrasted with the physical row number in the table.


Example

OPEN DATABASE southwind
SELECT rownum(), recno(), state from example where state = "MA"


Products

Recital, Recital Server