Quote: "How can I display one random item from the first list and a completely separate item from a different/second list? For example: the first list is cities and the second is mascots. New to DB and need some help. Thanks!"
List is a bit of an ambiguous term. But as others have stated above, an array is most likely what you'd need.
To tie two separate arrays together that have a relationship, you have to find something common in the relationship. This is often called an indexing key.
If you had two arrays:
Cities$()
Mascots$()
You can link them by having some common value. If we look at them like fields in a database table, we can use a third array Table() to link the two other arrays together:
Dim table(10,1)
Where the first index, 10, represents how many records +1, and the second index ,1, represents two values : 0 stores the city number, and 1 stores the mascot number
so table(0,0) holds the value of the city for the first record
table(0,1) holds the value of the mascot for the first record
And so on for the rest of the records.
Let's say the first record in the table has the city as London, and the mascot is a Cat. In our cities$() and mascots$() arrays, we would have the names of the various cities and the various mascots stored as separate indexes:
Mascots$(0)="dog"
Mascots$(1)="cat"
etc.
Cities$(0)="New York"
Cities$(1)="Xiang Hai"
Cities$(2)="London"
etc.
In the table() array, we would set up a link between cities and mascots by assigning the index numbers to the correct record in the table:
table(0,0)=2 (index 2 is London in the cities$() array)
table(0,1)=1 (index 1 is cat in the mascots$() array)
If I choose the first record from the table(), I can get the City and the Mascot that belongs to that record:
print Cities$(table(0,0))
print Mascots$(table(0,1))
So if the cities$() and mascots$() arrays were filled in, and I assigned these value to the records in the table, I could randomly choose any single record in the table and get back the City and the Mascot that belongs to that city.
This is a complex way of managing arrays but it's the beginning of setting up what could be a very versatile database. You could add additional "fields" to the table of various data types.
A simpler way to deal with everything as the same data type (strings in this case) would be to use one 2 dimensional array:
dim information$(10,1)
where 10 is the number of records +1
and 1 are the number of pieces of data stored per record +1
so we could say
information$(0,0)="London"
information$(0,1)="Cat"
This is more direct and easier than using the table linking method and will probably serve for most situations.
I mentioned the table linking method because it is a way to manage data without repeating the data. If you had 20 cities that all had cats as mascots, you could store "cat" once in the mascots array, and then just link that one item of data to each city that needs it instead of taking up memory by storing "cat" 20 times.
Enjoy your day.