mardi 5 octobre 2021

Extract random values from two tables in a MariaDB to generate bogus data

Scenario: For a community system project, I need some testing data, like users and full names. From a database with three tables: firstname_male, firstname_female, lastname, in which I have long lists of such names, I want to produce a bogus member list by selecting at random in one query a number of firstnames and add a lastname at random to each.

This works for one table:

MariaDB[namesdb]> select firstname from firstname_male order by rand() limit 10;

How can I add a random lastname to each of those 10 firstnames?




Aucun commentaire:

Enregistrer un commentaire