Skip to content

Instantly share code, notes, and snippets.

@loiclefevre
Created April 28, 2023 16:57
Show Gist options
  • Save loiclefevre/befc05da50f52f309325d9122ddf04cf to your computer and use it in GitHub Desktop.
Save loiclefevre/befc05da50f52f309325d9122ddf04cf to your computer and use it in GitHub Desktop.
import-javascript-es-modules-m.sql
-- Generate 2 random JSON documents for fictious races
-- We display the JSON document formatted for better readability
select json_serialize( chance.template( json {'raceId': { '$natural': {'min': 1, 'max': 99999} },
'name': 'name',
'laps': { '$natural': {'min': 5, 'max': 42} },
'date': 'date',
'podium': {} } ) pretty ) as new_races
connect by level <= 2;
NEW_RACES
__________________________________________
{
"date" : "2056-11-14T13:26:53.751000Z",
"laps" : 35,
"name" : "Scott Wilkins",
"podium" :
{
},
"raceId" : 64315
}
{
"date" : "2060-10-11T13:18:00.826000Z",
"laps" : 5,
"name" : "Wesley Ramsey",
"podium" :
{
},
"raceId" : 84434
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment