JSFiddle - React, Tailwind, and code Playground

by Andrey Gershun

HTML

<script src="http://alasql.org/console/alasql.min.js"></script>
<span id="res"></span>

JavaScript

var authors = 
[  { id: 1, name: 'adam'},
   { id: 2, name: 'bob'},
   { id: 3, name: 'charlie'}
];

var books = 
[  { author_id: 1, title: 'Coloring for beginners'}, 
   { author_id: 1, title: 'Advanced coloring'}, 
   { author_id: 2, title: '50 Hikes in New England'},
   { author_id: 2, title: '50 Hikes in Illinois'},
   { author_id: 3, title: 'String Theory for Dummies'}, ];
 
var res = alasql('SELECT * FROM ? authors LEFT JOIN ? books ON authors.id = books.author_id',[authors, books]);

document.getElementById("res").textContent = JSON.stringify(res);