JSFiddle - React, Tailwind, and code Playground

HTML

<script src="https://rawgit.com/agershun/alasql/master/alasql.min.js"></script>
<button id="btn">Add a student</button>
<p>Query result: </p>
<div id="result"></div>

JavaScript

// Create database
var db = new alasql.Database();
db.exec('CREATE TABLE students (studentid INT, school STRING)');

if(localStorage['students']) {
    db.tables.students.data = JSON.parse(localStorage['students']);
} else {
    db.tables.students.data = [
       {studentid: 55, school: 'abc'},
       {studentid: 56, school: 'klm'},
       {studentid: 57, school: 'nyz'}
    ];
    localStorage['students'] = JSON.stringify(db.tables.students.data);
};

console.log(db.tables.students.recs);

showres();

function showres() {
    var res = db.exec("SELECT * FROM students WHERE school > 'ght'");
    document.getElementById("result").innerHTML =   JSON.stringify(res);
}

document.getElementById('btn').onclick = function () {
    db.tables.students.data.push({student: 100, school:'qwe'}); 
    localStorage['students'] = JSON.stringify(db.tables.students.data);
    showres();
};