ローカルのSQLiteファイルを読み込むsql.jsというライブラリがありましたので、試しにサンプルを以下実装してみました。
https://sql.js.org/documentation/
text
1.
2├─ index.html
3└─ data.sqlite
sql
1CREATE TABLE "users"
2 (
3 "id" integer NOT NULL,
4 "name" varchar NOT NULL,
5 PRIMARY KEY (id)
6 )
7;
8
9INSERT INTO "users"
10 ("id", "name")
11VALUES
12 ('1', 'Tanaka Tarou'),
13 ('2', 'Kimura Hanako')
14;
html
1<div>
2 <input id="file-field" type="file" accept=".sqlite">
3</div>
4
5<div>
6 <input id="query-field" placeholder="SELECT * FROM users;" disabled>
7
8 <button id="execute-button" disabled>EXECUTE QUERY</button>
9</div>
10
11<div>
12 <pre id="result-text"></pre>
13</div>
14
15<script src="https://cdnjs.cloudflare.com/ajax/libs/sql.js/1.6.1/sql-wasm.min.js"></script>
16<script>
17initSqlJs({
18 locateFile: (file) => `https://cdnjs.cloudflare.com/ajax/libs/sql.js/1.6.1/sql-wasm.wasm`,
19}).then((SQL) => {
20 let db = null;
21
22 const fileField = document.querySelector("#file-field");
23 const queryField = document.querySelector("#query-field");
24 const executeButton = document.querySelector("#execute-button");
25 const resultText = document.querySelector("#result-text");
26
27 fileField.addEventListener("change", (event) => {
28 const file = fileField.files.item(0);
29
30 if (!file) {
31 return;
32 }
33
34 const fileReader = new FileReader();
35
36 fileReader.addEventListener("load", (event) => {
37 db = new SQL.Database(new Uint8Array(fileReader.result));
38
39 fileField.disabled = true;
40
41 queryField.disabled = false;
42
43 executeButton.disabled = false;
44 });
45
46 fileReader.readAsArrayBuffer(file);
47 });
48
49 executeButton.addEventListener("click", (event) => {
50 const rows = db.exec(queryField.value);
51
52 resultText.innerHTML = JSON.stringify(rows, null, " ");
53 });
54});
55</script>
また、HTMLで表示をカスタマイズしたいとかでなければ、TablePlusなどDBMSを調べてみてもいいかもしれません。
https://www.youtube.com/watch?v=xtaIeSHb4LY