let script document createElement script script src https cdnjs cloudflare com ajax libs sql js 1 2 1 dist sql asm debug js document body appendChild script onload function async const SQL await initSqlJs const db new SQL Database console log db console log db exec SELECT 1 end onload let script document createElement script script src https cdnjs cloudflare com ajax libs sql js 1 2 1 dist sql asm debug js document body appendChild script onload function async const SQL await initSqlJs const db new SQL Database console log db var st DROP TABLE IF EXISTS test CREATE TABLE test id integer name text designation text manager integer hired_on date salary integer commission float dept integer INSERT INTO test VALUES 1 JOHNSON ADMIN 6 1990 12 11 18000 NULL 4 INSERT INTO test VALUES 2 HARDING MANAGER 9 1998 02 02 52000 300 3 INSERT INTO test VALUES 3 TAFT SALES I 2 1996 01 02 25000 500 3 INSERT INTO test VALUES 4 HOOVER SALES I 2 1990 04 02 27000 NULL 3 INSERT INTO test VALUES 5 LINCOLN TECH 6 1994 06 23 22500 1400 4 console log db run st var stmt db prepare SELECT hired_on FROM test WHERE id 4 while stmt step var row stmt getAsObject console log Result JSON stringify row end onload
designation text manager integer hired_on date salary integer commission float dept integer INSERT INTO test VALUES 1 JOHNSON ADMIN 6 1990 12 11 18000 NULL 4 INSERT INTO test VALUES 2 HARDING MANAGER 9 1998 02 02 52000 300 3 INSERT INTO test VALUES 3 TAFT SALES I 2 1996 01 02 25000 500 3 INSERT INTO test VALUES 4 HOOVER SALES I 2 1990 04 02 27000 NULL 3 INSERT INTO test VALUES 5 LINCOLN TECH 6 1994 06 23 22500 1400 4 console log db run st var stmt db prepare SELECT hired_on FROM test WHERE id 4 while stmt step var row stmt getAsObject console log Result JSON stringify row end onload