基本查詢

/* Define a query named q1 for the Customer table */
DEFINE QUERY q1 FOR Customer.
/* Open the query for all Customer records where the state is "tx" */
OPEN QUERY q1 FOR EACH Customer WHERE Customer.state ='TX'.                                                                                                                                                                               
/* Get the first result of query q1 */
GET FIRST q1.                                                                                                                                                                                                                   

/* Repeat as long as query q1 has a result */
DO WHILE NOT QUERY-OFF-END('q1'):          
    /* Display Customer.Name in a frame called frame1 with 10 rows */
    DISPLAY Customer.Name WITH FRAME frame1 10 DOWN.
    /* Move down the target line where to display the next record */
    DOWN WITH FRAME frame1.
    /* Get the next result of query q1 */
    GET NEXT q1.
END.
/* Display how many results query q1 had. */
DISPLAY NUM-RESULTS('q1') LABEL "Number of records".

/* Close the query */
CLOSE QUERY q1.                                              

輸出(Windows gui 中的第三個螢幕):

StackOverflow 文件