Tuesday, September 21, 2010

Assignment 1 Printing numbers

Print numbers 1-10 in sql

Solution:

We can execute the solution in many ways.

A couple of them are :

Solution 1

SELECT rownum as num FROM transaction
WHERE rownum <= 10

or if I were to use level ;

Solution 2

SELECT Level as num
FROM dual
CONNECT BY Level <=10

If you have any questions or better solutions, please post comments.

No comments:

Post a Comment