How to create SQLite comments

SQLite FAQ: How do I create comments in SQLite?

Solution

You can create SQLite comments using two different constructs, either:

  1. two hyphens in sequence ("--"), or
  2. the "/.../" C-style comments

SQLite comment examples

Here are examples of each approach, with the SQLite comment examples preceding the two database table definitions:

--
-- this is a comment
--
CREATE TABLE salespeople (
  id INTEGER PRIMARY KEY,
  first_name TEXT NOT NULL,
  last_name TEXT NOT NULL,
  commission_rate REAL NOT NULL
);

/*
 * this is also
 * a comment
 */
CREATE TABLE customers (
  id INTEGER PRIMARY KEY,
  company_name TEXT NOT NULL,
  street_address TEXT NOT NULL,
  city TEXT NOT NULL,
  state TEXT NOT NULL,
  zip TEXT NOT NULL
);

Although the C-style comments are made for multiline comments, I actually prefer the -- approach myself, but either one is fine.