In RDBMS, this is modeled as two tables with a one-to-many relationship: table M with messages has a foreign key to the table N, with list names:
create table N (
id bigint identity primary key
, listName varchar(max)
)
create table M (
id bigint identity primary key
, n_id bigint not null references N(id)
, message varchar(max)
)
Be prepared that RDBMS is a big paradigm shift from what you've seen in "imperative" programming with traditional algorithms and data structures. Don't worry, it will all make sense in time as you work your way through a few dozen examples.
Good luck!