Skip to content

SQLite

To enter the SQLite database, use the following command:

sqlite3 test.db

To view the tables in the database, use the following SQL command:

.tables

To exit the SQLite database, use the following SQL command:

.quit

To execute an SQL script, use the following command:

.read xxx.sql

To delete a column from a table, follow these steps:

ALTER TABLE xxx RENAME TO yyy; -- Rename the table
.read new_xxx.sql  -- Create a new table without the column
INSERT INTO xxx SELECT * FROM yyy; -- Copy data from the renamed table to the new table
DROP TABLE yyy; -- Drop the renamed table


Last update: September 16, 2023