Complete the code to import the SQLite module in Deno.
import { DB } from "[1]";
The SQLite module for Deno is imported from https://deno.land/x/sqlite/mod.ts. This allows you to use the DB class to work with SQLite databases.
Complete the code to create a new in-memory SQLite database.
const db = new DB("[1]");
Using :memory: creates a new SQLite database in memory, which is temporary and faster for testing or small tasks.
Fix the error in the code to execute a SQL statement that creates a table.
db.[1]("CREATE TABLE users (id INTEGER PRIMARY KEY, name TEXT)");
query for statements that do not return rows.execute which is not a method in Deno's DB.The run method executes SQL statements that do not return rows, such as CREATE TABLE.
Fill both blanks to insert a user with id 1 and name 'Alice' into the users table.
db.run("INSERT INTO users (id, name) VALUES ([1], [2])");
The id is a number 1 and the name is a string, so it must be quoted with single quotes 'Alice' in SQL.
Fill all three blanks to query all user names from the users table and log them.
for (const [[1]] of db.query("SELECT [2] FROM [3]")) { console.log([1]); }
The query selects the name column from the users table. The loop destructures the row to get the name value and logs it.
