8967_static.p
| 1 |
DEFINE TEMP-TABLE customers |
|---|---|
| 2 |
field customer_id as INT |
| 3 |
field customer_name as character |
| 4 |
index Idxcustomer_id is unique customer_id |
| 5 |
. |
| 6 |
|
| 7 |
DEFINE TEMP-TABLE orders |
| 8 |
field customer_id as INT |
| 9 |
field order_amount as int |
| 10 |
|
| 11 |
. |
| 12 |
|
| 13 |
create customers. |
| 14 |
customers.customer_id = 1. |
| 15 |
customers.customer_name = 'John Doe'. |
| 16 |
|
| 17 |
create customers. |
| 18 |
customers.customer_id = 2. |
| 19 |
customers.customer_name = 'John Smith'. |
| 20 |
|
| 21 |
create orders. |
| 22 |
orders.customer_id = 1. |
| 23 |
orders.order_amount = 10. |
| 24 |
|
| 25 |
create orders. |
| 26 |
orders.customer_id = 1. |
| 27 |
orders.order_amount = 20. |
| 28 |
|
| 29 |
create orders. |
| 30 |
orders.customer_id = 2. |
| 31 |
orders.order_amount = 15. |
| 32 |
|
| 33 |
// Insert sample data into the orders table |
| 34 |
|
| 35 |
|
| 36 |
// Fetch and display the data |
| 37 |
FOR EACH customers of orders WHERE orders.customer_id = customers.customer_id: |
| 38 |
DISPLAY customers.customer_name orders.order_amount. |
| 39 |
END. |