1.1 Getting positions of members based on a specified condition

 

Find ordinal numbers of the student records in the Scores table where SCORE is 90 or above.

STUDENTID SCORE
1 84
2 77
3 69
4 81
5 80

SPL script:

A
1 =connect(“db”)
2 =A1.query@x(“select * from Scores”)
3 =A2.pselect@a(SCORE>=90)

A1 Connect to the database;
A2 Retrieve Scores table from the database;
A3 Get ordinal numbers of records where SCORE is 90 or above. pselect@a returns ordinal numbers of all records meeting the specified condition. Without @a option, pselect function returns ordinal number of the first found eligible record only.