Skip to main content
Deno 2 is finally here 🎉️
Learn more
Module

x/sqlite/src/db.ts>DB#execute

Deno SQLite module
Go to Latest
method DB.prototype.execute
import { DB } from "https://deno.land/x/sqlite@v3.8/src/db.ts";

Run multiple semicolon-separated statements from a single string.

This method cannot bind any query parameters, and any result rows are discarded. It is only for running a chunk of raw SQL; for example, to initialize a database.

Example

db.execute(`
  CREATE TABLE people (
    id INTEGER PRIMARY KEY AUTOINCREMENT,
    name TEXT,
    age REAL,
    city TEXT
  );
  INSERT INTO people (name, age, city) VALUES ("Peter Parker", 21, "nyc");
`);

Parameters

sql: string