How could the generator be used to generate relational data?
If we take a simple one-to-many relationship...
A database that has a department table, with DeptNo as a primary key
| DeptNo | DeptName |
|---|---|
| 10 | Marketing |
| 20 | Purchasing |
And an employee table, where each employee has a department:
| EmpNo | EName | DeptNo |
|---|---|---|
| 101 | Abigail | 10 |
| 102 | Bob | 20 |
| 103 | Carolyn | 10 |
| 104 | Doug | 20 |
| 105 | Evelyn | 10 |
How could we generate this data?
We could perhaps generate each table using a different profile. In the example above we could generate the 'department' table:
Q. How would we ensure that the DeptNo field is unique? Would this constrain us to using a full sequential generation mode and a range constraint? Could we perhaps add a 'unique' constraint?
Once the department table is generated, we could then generate the employee table. If a full sequential generation were used for department, then I guess we'd just have to apply the same range constraints for the DeptNo in the employee table?
- could be different profiles
- could be flattened/denormalised and for the user to normalise for use
- also describes unique keys (e.g. EmpNo) but not the primary requirement
currently our data generator only generates rows of data.
one option is to have a relational generator, that calls onto our rowGenerator for each table, and combines the results