Sub FillGradesTable
'Building this table is a little bit more complicated.
'We will create 20 tests and for each test we will give each student a grade.
'We need to first get the list of possible student IDs.
Dim Table As List
Table = DBUtils.ExecuteMemoryTable(SQL, "SELECT Id FROM Students", Null, 0)
'Table is a list of arrays. Each array holds a single item.
Dim Cols() As String
Dim ListOfMaps As List
ListOfMaps.Initialize
For test = 1 To 20
For student = 0 To Table.Size - 1
Dim m As Map
m.Initialize
Cols = Table.Get(student)
m.Put("Id", Cols(0))
m.Put("Test", "Test #" & test)
m.Put("Grade", Rnd(0, 101)) 'The upper value is exclusive
ListOfMaps.Add(m)
Next
Next
DBUtils.InsertMaps(SQL, "Grades", ListOfMaps)
End Sub