Forrest logo
back to the sqlite-utils tool

sqlite-utils:tldr:e01e5

sqlite-utils: Create a table.
$ sqlite-utils create-table ${path-to-database-db} ${table_name} ${id integer name text height float photo blob --pk id}
try on your machine

This command is using the sqlite-utils package to create a new table in a SQLite database.

Here is a breakdown of the command:

  • sqlite-utils: This is the command-line tool provided by the sqlite-utils package.
  • create-table: This is the command within the sqlite-utils tool that allows you to create a new table in a SQLite database.
  • ${path-to-database-db}: This is the path to the SQLite database file where you want to create the table.
  • ${table_name}: This is the name of the table you want to create in the database.
  • ${id integer name text height float photo blob --pk id}: This part specifies the columns of the table and their corresponding data types. In this example, the table has five columns:

    • id: This is a column of type integer and serves as the primary key (specified using --pk id). Primary keys uniquely identify each row in the table.
    • name: This is a column of type text and stores textual data.
    • height: This is a column of type float and stores decimal numbers.
    • photo: This is a column of type blob, which stands for binary large object, and it can store binary data such as images or files.

So, when you run this command, a new table with the specified columns will be created in the SQLite database file at the specified path.

This explanation was created by an AI. In most cases those are correct. But please always be careful and never run a command you are not sure if it is safe.
back to the sqlite-utils tool