0

如何编写正在进行的查询?

如何在 Sports 数据库中显示 Table 中的所有数据。

为我提供一些链接,以便在初学者级别进行查询练习。

4

3 回答 3

2
DEFINE QUERY q1 for customer scrolling.
OPEN QUERY q1 for each customer where state='TX'.
Get first q1.
Display name.
Do while NOT QUERY-OFF-END('q1'):
    Get next q1.
    If AVAILABLE customer then do: 
        Display name.
    End.
    Display num-results('q1') label "Number of records".
End.
Reposition q1 (to/forwards/backwards) 5.
get next q1.
display name.
CLOSE QUERY q1.

多表

Define query q1 for customer, order, orderline.
Open query q1 for each customer where state='TX',~
     each order of customer,~
     each orderline of order.

     …
于 2016-12-02T14:16:09.023 回答
2

上面的答案很完美。但我只会添加更简单的方法,因为我得到了一种 OP 不太了解的氛围,所以他们甚至可能没有正确地提出问题。因此,这是在体育数据库中显示客户表中所有数据的最简单方法:

FOR EACH customer:
    DISPLAY customer with side-labels.
END.

只需查看 OpenEdge 教程,您应该能够找到一些可以教您基础知识的东西。祝你好运!

于 2016-12-05T00:51:36.253 回答
1

如果 OpenEdge 给出错误

**FILL-IN Comments will not fit in FRAME in PROGRAM . (4028)

那么这意味着,显示的默认框架不够大。默认帧的宽度为 80,但在 SportsDB.Customer.Comments 中以格式“x(80)”定义。这意味着,您必须以这种方式处理评论,它适合框架。

一种可能的解决方案是使用默认框架,但以不同的方式处理 Comments 字段:

FOR EACH customer:
     DISPLAY Customer EXCEPT Customer.Comments WITH SIDE-LABELS.
     DISPLAY Customer.Comments format "x(50)".
END.            

另一种可能的解决方案是使用您自己的框架

DEFINE FRAME demo WITH SIZE 135 by 24.
FOR EACH customer:
     DISPLAY customer  WITH  FRAME demo SIDE-LABELS.
END.            
于 2016-12-05T10:34:24.270 回答