Sample data: O

Previous  Top  Next

 

Orders & order-lines

Customer orders with several order lines are a typical case for databases. The example can be expanded to "shopping cart with several items" and many other types of data. Below is a way to generate data for such a case. The Sample Video has a

 

Generating these is a two-step process:

1.generate the orders
2.for each order, generate at least 1 order line (with a product)

 

Orders table

Generate fixed number or random numbers of rows, eg: 2500.

 

OrderID

Sequential number, starting at 1, increase by 1

CustomerID

Referential Link to Customers table

OrderDate

Random date

ExpectedDeliveryDate

Value based on "order date", but increased with a few hours

CustomerNotes

Random paragraph, mostly empty

 

ORDERS table example

 

Order Lines table

Generate between 1 and 20 rows "for each in" the orders table. Select the OrderLines table and for Rows, select For each in... - then select the "master item" from the list: Orders. Enter values for "between 1 and 20" rows.

 

When generating data for the OrderLines table, you can select values from the "master" item, if required.

 

OrderID

A link to the Orders table, here generated as a "master value"

OrderLineID

A sequential number, starting at 1, unique for each "master" record

ProductID

Referential link to the Products table, or a "lookup value" if the "product_price" should be correct.

Product_Price

Either a sample random value or a "lookup value" if it needs to be the same as in the Products table for the given ProductID.

Quantity

Random number for the ordered quantity.

 

ORDERLINES table example